Tell me how can you declare a block in ruby?
Answer / Chandrakant Giri
A block in Ruby is defined using the curly braces `{}` or keywords do and end. It should be placed after a method call with a preceding semicolon (;) if it's not part of the method definition itself. For example:ntmy_method { # code here }nOr using do and end:ntmy_method {n# code heren}n
| Is This Answer Correct ? | 0 Yes | 0 No |
Explain ampersand parameter (&block) in Ruby?
What does ruby name refers to?
Explain next statement in ruby.
Explain Ruby object?
Do you know what is the defined operator?
What is yield in ruby?
Explain about Float, Dig and Max?
Explain Ruby module?
What is the difference between a statement and an expression in ruby?
what is the Notation used for denoting class variables in Ruby?
How would you freeze an object in ruby?
what is the role of sub-directory app/controllers and app/helpers?