/test/pending/closed_upval.rb

http://github.com/feyeleanor/RubyGoLightly · Ruby · 11 lines · 7 code · 2 blank · 2 comment · 0 complexity · 20edf63a6d241aac8fdf9cfddd2cc790 MD5 · raw file

  1. def add(x)
  2. Proc.new do |y|
  3. x + y
  4. end
  5. end
  6. puts add(2).call(3)
  7. # => 5
  8. puts add(3).call(5)
  9. # => 8