View Single Post
  #5 (permalink)  
Old 03-31-2008, 09:49 PM
shaalini shaalini is offline
D-Web Analyst
 
Join Date: Apr 2007
Posts: 342
shaalini is on a distinguished road
Default Re: Ruby BuiltIn functions

block_given?

block_given? -> true or false


Returns true if yield would execute a block in the current context.

def try
if block_given?
yield
else
"no block"
end
end
try » "no block"
try { "hello" } » "hello"
try do
"hello"
end
__________________
Shaalini.S
Be the Best of Whatever you are...
Reply With Quote