Method names can coincide with keywords or local/constant variable names. This is usually not a problem because the dot notation makes things clear. class MyClass def end # keyword as method name puts "The End" end end obj = MyClass.new obj.end # The End Local variables may be confused with a private method of the same name, since private methods can be called without dot notation or parentheses, so be careful. def var # method belongs to Object class by default "not 5" end puts var # not 5 var = 5 # local variable puts var # 5 puts var() # not 5 Knowing what Ruby will do is going to take practiceRuby is more complex than Python. |