ruby – 为什么我所有的回报=> nil?

我知道这可能看起来像一个非常简单的问题,但是我真的困扰我,我的投注继续产生“= 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在正常应用程序中不显示其返回值.

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...