在 Python 中,您可以使用 _
字段来获取最后计算的值。这在 IDLE 中非常有用。 Ruby 是否有 IRB 的等价物?
来自 Python 的示例:
>>> 2 + 2
4
>>> _
4
>>> "Me " + "You"
'Me You'
>>> _
'Me You'
最佳答案
_ 不工作?
host:~ user$ irb
irb(main):001:0> s = "test"
=> "test"
irb(main):002:0> puts _
test
=> nil
关于python - Python "_"的 Ruby 等价物,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4834125/