Ruby - Operators and Expressions
What will be the output of this Ruby code?
a = nil b = 20 a ||= 10 b ||= 30 puts a puts b
a = nil b = 20 a ||= 10 b ||= 30 puts a puts b
a ||= 10 when a is nila is nil, a ||= 10 assigns 10 to a.b ||= 30 when b is 20b is already 20 (truthy), b ||= 30 does not change b.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions