Created
April 2, 2011 07:56
-
-
Save songpp/899319 to your computer and use it in GitHub Desktop.
ruby block given ?
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
def t1(ar1,ar2,&block) | |
if(block_given?) | |
yield(ar1,ar2) | |
else | |
puts ar1 , ar2 | |
end | |
block.call(ar1,ar2) | |
end | |
t1(1,2)do|f,s| | |
puts "first #{f} + second #{s}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment