Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: None  |  size: 0.20 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. addition = Proc.new { |x, y| x + y }
  2. addition.call(3, 2) # => 5
  3.  
  4. subtraction = lambda { |x, y| x - y }
  5. subtraction.call(3, 2) # => 1
  6.  
  7. multiplication = -> x, y { x * y }
  8. multiplication.call(3, 2) # => 6