Author Archives:

Blocks, Procs & Lambdas

Blocks A block is pretty straightforward. There’s the do … end block: If I’ve got an array of numbers: numbers = [1,2,3,4] do |num| num * num end or the single-line curly braces block numbers.each { |num| num * num } Proc (procedure) This is kind of a “named” block that you can save...
Read More