I got error as undefined variable
, I know nil
is evaluated to false
if used as boolean:
if y
puts "Something"
end
There's a slight wrinkle on this. Try this:
if 5 == 0
y = 'hi'
end
puts "hello" if y
y
has been "defined" in the if
block. Remove that block and this gives an error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With