我知道这似乎是一个非常简单的问题,但我的 puts 不断生成“=> nil”让我很困扰,我搜索了答案但找不到答案。谢谢。
puts 'blink ' *4 blink blink blink blink => nil
最佳答案
因为那是puts
的返回值:
puts(obj, ...) → nil
Writes the given objects to ios as with IO#print. Writes a record separator (typically a newline) after any that do not already end with a newline sequence. If called with an array argument, writes each element on a new line. If called without arguments, outputs a single record separator.
来源:http://www.ruby-doc.org/core-1.9.3/IO.html#method-i-puts
此外,我假设这只是在 irb
中?因为在正常应用程序中调用 puts
不会显示其返回值。
关于ruby - 为什么我所有的看跌期权都返回=>nil?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14741329/