Search
 
SCRIPT & CODE EXAMPLE
 

RUBY

ruby block_given? method

# used when we call method with and without block from different places
def try
  if block_given?
    yield
  else
    "no block"
  end
end
try                  #=> "no block"
try { "hello" }      #=> "hello"
try do "hello" end   #=> "hello"
Comment

PREVIOUS NEXT
Code Example
Ruby :: how to access function defined in model rails 
Ruby :: ruby find by multiple columns 
Ruby :: ruby on rails multiple models pagination 
Ruby :: ruby on rails recover data in params with form tag 
Ruby :: comments in ruby grepper 
Ruby :: devise trackable not working for authentication 
Ruby :: ruby URI.open with proxy 
Ruby :: Ruby exclude from slice 
Ruby :: ruby find lower number array object 
Ruby :: rails has_many through source 1 
Ruby :: ruby file copy 
Ruby :: rails rspec test email sent 
Ruby :: is this consistent with ruby-class A<b::c::C::D::e 
Ruby :: division in ruby 
R :: r list files in directory 
R :: generate all possible combinations of a set of characters r 
R :: tbale() in R 
R :: merge multiple objects in r 
R :: how to find the R packages and versions 
R :: How to Convert a Factor in R 
R :: correlation matrix in r 
R :: turn row names into column in r 
R :: lubridate sequence of dates 
R :: strtrim in r 
R :: change the y ticks in r plot 
R :: remove name of a column 
R :: rstudio 
R :: distance matrix in r 
R :: how to add in dictionary in R 
R :: create datframe on r 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =