Skip to content

Instantly share code, notes, and snippets.

@tsevdos
Created Sep 13, 2015
Embed
What would you like to do?
Ruby tips : block_given? on yields
def yo
if block_given?
yield
else
puts "No block :-("
end
end
yo # => No block :-(
yo { puts "Yo man" } # => Yo man
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment