ruby alias

Posted: April 16, 2007 in ノート, RUBY, Technology
irb(main):001:0> a = 2 unless 2.nil?
=> 2
irb(main):002:0> a
=> 2
irb(main):003:0> b = 2 || b 
=> 2
irb(main):004:0> c ||= 2
=> 2
irb(main):005:0> c
=> 2
irb(main):006:0> a == b
=> true
irb(main):007:0> b == c
=> true

tinggalkan feedback konstruktif atau lebih baik diam

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s