Comparison between &&= and ||=

&&=    ||=

Example 1 x=5 x=5
y=7 y=7

x&&=y x||=y
X=7 x=5
y=7 y=7

Example 2 x=nil x=nil
y=7 y=7

x&&=y x||=y
x=nil x=5
y=7 y=7

Example 3 x=5 x=5
y=nil y=nil

x&&=y x||=y
x=nil x=5
y=nil y=nil




Comments

Popular posts from this blog

Standard of Code Sequence of model

Difference between was, before_last_save, changed and changed?

Setup Rspec