The Closure Zoo

They vary based on how they deal with

Rule #1: ignore lambdas

Rule #2: blocks are procs

Rule #3: def breaks scope; do doesn't

x = 7

proc { puts x }.call #=> 7

def foo
  puts x
foo #=> NameError: undefined local variable or method `x'

Rule #4: don't worry about it

Block Parameters

 Previous Lesson Next Lesson