我知道这总是让 returnnil
本身。
但是我已经知道这个事实,我已经开始玩弄它了。这里是:
>> puts
=> nil # Good, you are doing what I expected.
>> puts 15
15
=> nil # nil is for puts and 15 it printed,as it is assigned to do. perfect still.
>> puts a = 5 + 2
7
=> nil # still good.
现在我会做更多的事情puts
来看看它有多强大。
>> puts a= 5 + 2;b= 2+3
7
=> 5 #ahh! where is nil?
>> puts a= 5 + 2;b= 2+3;c= 4+8
7
=> 12 # again no nil. Another confusion created here that why 12 and 7 only, how 5 has been skipped?
价值如何puts
nil
被压制?
好的,让我们测试另一种方式nil
。
>> x=puts a= 5 + 2;b= 2+3;c= 4+8
7
=> 12
>> puts x
=> nil # humm, nil is there. but why not nil => nil? Confusion here again goes up. whose nil is it?
puts
任何人都可以通过说出Ruby世界中的实际行为来帮助我吗?