Created
May 12, 2012 15:59
-
-
Save charly-palencia/2667293 to your computer and use it in GitHub Desktop.
Class variable like global variables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestVariable | |
@@A=1 | |
def print_v | |
@@A | |
end | |
end | |
@@A="WHY?" | |
test= TestVariable.new | |
p test.print_v #=> WHY? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment