Created
January 20, 2015 15:32
-
-
Save teenst/c202aeaf0e16d0cad500 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env ruby | |
def block_sample | |
puts 'stand up' | |
yield if block_given? | |
puts 'sit down' | |
end | |
block_sample do | |
puts 'walk' | |
end | |
block_sample() |
This file contains 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
#!/usr/bin/env ruby | |
catch :triple_loop do | |
loop do | |
puts 'one' | |
loop do | |
puts 'two' | |
loop do | |
puts 'three' | |
throw :triple_loop | |
end | |
end | |
end | |
end |
This file contains 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
#!/usr/bin/env ruby | |
catch :entire do | |
catch :process do | |
throw :entire | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment