Alternative Block Syntaxes
Get to know some alternative syntaxes that we use for blocks in Ruby.
We'll cover the following
An alternative way to define blocks
Along with the syntax shown before, using do
and end
, Ruby comes with an alternative syntax, which uses curly braces to define a block.
These two statements do exactly the same thing:
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy