0
I recently saw this decision-making in a ruby code:
if __FILE__ == $0
....
So I had it printed out __FILE__
and $0
separately in irb and saw that the two pass the same information, my doubts are:
- Why (when) make this comparison?
- Why not compare with the same command (
__FILE__ == __FILE__
)? - Have some method to get the file name directly by
__FILE__
without having to filter?