-
-
Save robins35/bb3dbd2dcc13a72b9d2a39ba1a73fee3 to your computer and use it in GitHub Desktop.
This file contains 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
irb(main):003:0> class Test | |
irb(main):004:1> def x | |
irb(main):005:2> @x | |
irb(main):006:2> end | |
irb(main):007:1> def x=(flag) | |
irb(main):008:2> false && (@x = flag) | |
irb(main):009:2> end | |
irb(main):010:1> end | |
=> nil | |
irb(main):011:0> t = Test.new | |
=> #<Test:0x7f22debbe308> | |
irb(main):012:0> t.x | |
=> nil | |
irb(main):013:0> t.x = true | |
=> true | |
irb(main):014:0> t.x | |
=> nil | |
irb(main):015:0> t.x = false | |
=> false | |
irb(main):016:0> t.x | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment