irb tip: get last returned value

Just use underscore.

1
2
3
4
>> "Chunky bacon"
=> "Chunky bacon"
>> _
=> "Chunky bacon"

The fruits of an investigation I started when Jon Baudanza at Rupture offered a brownie bite for the first person to figure it out. I’ll do pretty much anything for a brownie bite…

Update: you can also use conf.last_value, as well as its aliases context.last_value and irb_context.last_value.

Comments

  1. JonJune 02, 2008 @ 12:54 PM

    Brownie bite well deserved!

Post a comment

Comment
(not published)
(optional)