Created
October 27, 2015 11:26
-
-
Save swanandp/9d50dc20dfb99a4ee68b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Valid syntax | |
def do_stuff(arg1) | |
do_something(arg1) | |
rescue AnError => e | |
process_error(e) | |
end | |
# Syntax Error | |
do_stuff = lambda do |arg1| | |
do_something(arg1) | |
rescue AnError => e | |
process_error(e) | |
end | |
# So you can't do something like: | |
method_that_accepts_blocks(argument) do |yield_argument| | |
perform_some_stuff | |
do_something_else(yield_argument) | |
rescue SomeError => e | |
handle_error(e) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment