News for hackers. Stuff that matters.
Re:My Mixed Feelings about Ruby by ezmobius on Monday June 30, 2008 @07:36PM (#232550)
now try this on for size. I'm sure you know how this works:

  > def a
  >   yield
  > end
  => nil
  > a { 42 }
  => 42
But did you know this?

  > def b
  >  Proc.new.call
  > end
  => nil
  > b { 42 }
  => 42
Proc.new without any arguments works the same as yield. tripped me out when I found this the other day.

There are no comments on this comment yet.