Skip to content

Instantly share code, notes, and snippets.

@tdg5
Created March 1, 2015 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdg5/12eccaae6132e72c0490 to your computer and use it in GitHub Desktop.
Save tdg5/12eccaae6132e72c0490 to your computer and use it in GitHub Desktop.
Errors during eager evaluation cause result of logical expression to be lost
or_result = nil
begin
or_result = true | Seriously(this(is(valid(Ruby!))))
rescue NameError
puts "NameError :("
end
# Name Error :(
or_result
# => nil
and_result = nil
begin
and_result = false & 0/0
rescue ZeroDivisionError
puts "ZeroDivisionError :("
end
# ZeroDivisionError :(
and_result
# => nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment