I keep getting this warning in console, it's cluttering my
d.rb:24: warning: previous definition of VariableA was here
d.rb:86: warning: already initialized constant VariableA
VariableA = nil
VariableB = nil
In ruby whenever you use a capital letter first letter you are creating a constant. You will be warned when it is redefined.
class THIS_IS_A_CONSTANT = 42 ThisIsAlsoAConstant = "The answer!" @@this_is_a_class_variable def a_method @this_is_a_member_variable = true this_is_a_local_variable = true end end
If you create a constant inside a method, you will get re-definition error the second time you call the method.