Skip to content

Instantly share code, notes, and snippets.

@lfborjas
Created July 31, 2012 14:05
Show Gist options
  • Save lfborjas/3217286 to your computer and use it in GitHub Desktop.
Save lfborjas/3217286 to your computer and use it in GitHub Desktop.
rescuing our vars from existential angst
puts "we can an expression in blocks hold"
x = begin; 'a'; end
y = begin; b = 42; end
puts "but identity crises, sometimes unfold"
z = begin; c; end
puts "we can rescue our little vars, though"
w = begin
o
rescue
"poor little oh!"
end
puts "crisis averted, #{w}"
w = begin
o
rescue NameError => e
"#{e} qui crois qui es tu?"
end
puts "or get diverted with a one-liner"
a = n rescue "like a chilean miner!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment