0 votes
in Ruby by
In how many ways a block is written in Ruby.

1 Answer

0 votes
by

A block is written in two ways:

Multi-line between do and end

Inline between braces {}

Both are same and have the same functionality.

For more information: Click here

syntax:

block_name{  

statement1  

statement2  

..........  

}  

...