为什么我所有的看跌期权都返回=> nil? [英] Why are all my puts returning =>nil?

查看:101
本文介绍了为什么我所有的看跌期权都返回=> nil?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这似乎是一个非常简单的问题,但确实困扰我我的看跌期权不断产生"=> nil",因此我搜寻了一个答案,但找不到答案.谢谢.

I know this may seem like a really simple question, but it really bothers me that my puts keep generating "=> nil" and I scoured for an answer but could not find one. Thanks.

放入闪烁" * 4 眨眼眨眼眨眼眨眼 =>无

puts 'blink ' *4 blink blink blink blink => nil

推荐答案

因为这是puts的返回值:

puts(obj,...)→无

puts(obj, ...) → nil

与IO#print一样,将给定的对象写入ios. 在任何不包含的记录后写一个记录分隔符(通常是换行符) 已经以换行符结尾.如果使用数组参数进行调用, 将每个元素写在新行上.如果不带参数调用 输出单个记录分隔符.

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不会显示其返回值.

Also, I assume this is just in irb? because calling puts doesn't display its return value in normal applications.

这篇关于为什么我所有的看跌期权都返回=> nil?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆