Tell me what are blocks and procs?
Answer / Ranjeet Kaur
In Ruby, a block is anonymous piece of code that can be passed around as an argument to methods. A Proc object (short for procedure) is a first-class function object that can be assigned to a variable, passed as an argument to other methods, and used to define default arguments. For example: `proc = Proc.new { puts 'Hello World' }; proc.call # outputs "Hello World"
| Is This Answer Correct ? | 0 Yes | 0 No |
what the difference is between false and nil in Ruby?
Please explain what are some advantages of using ruby?
How many types of associations relationships does a model has?
How do you handle exceptions in ruby code?
Are numeric objects mutable in ruby?
Explain until loop in ruby.
How to open a file in Ruby?
Explain how can we define ruby regular expressions?
Explain for loop in Ruby?
what is the Notation used for denoting class variables in Ruby?
What are the ruby variables?
How to create a new time instance in Ruby?