dimid dimid - 1 year ago 49
Ruby Question

How to reference an earlier output in pry

In python's

you can reference the output in the following way:

In [15]: s = "abcd"

In [16]: s
Out[16]: 'abcd'

In [17]: Out[16]
Out[17]: 'abcd'

What is the equivalent for ruby's

Answer Source

Using the _out_ and _in_ variables, as described in the docs.

E.g.: _out_[16] or _out_[-1] for the last result.