Title / Description
Code class User def set_user(string) string = Dog.new p {"Doggy Wolf"} end end class Dog end Tom = User.new("Tom") def method_one @var = "a variable" puts @var end def method_two puts @var end method_two() method_one() # Prints "a variable", because @var is assigned a value in method_one method_two() # Prints "a variable" now, because we have already called method_one
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code