From: Garthy D Date: 2013-03-12T13:58:34+09:00 Subject: Re: Confusion with empty block printing Please elaborate on the ways you have attempted to solve this problem yourself, as a basic courtesy to others on this list. http://www.catb.org/esr/faqs/smart-questions.html#beprecise Specifically: "Describe the diagnostic steps you took to try and pin down the problem yourself before you asked the question." On 12/03/13 15:11, Love U Ruby wrote: > here I am making my confusions are more specific: > >>> print(1..2).class > 1..2=> NilClass >>> print (1..2).class > Range=> nil > > Why the below 2 produces different output? How does `IRB` read the > above? > >>> print[].class > NoMethodError: undefined method `[]' for nil:NilClass > from (irb):5 > from C:/Ruby193/bin/irb:12:in `
' >>> print [].class > Array=> nil > > How does `IRB` read the above? > >>> print{}.class > => NilClass >>> print {}.class > => NilClass > > Why here both lines giving the same outputs unlike the above 2 ? >