From: Sarah Allen Date: 2010-04-15T07:14:54+09:00 Subject: Re: I thought spaces didn't matter around operators Brian Candler wrote: > Ah I see now, this is just what's called "poetry mode" - method calls > without parentheses around the argument list > > Time.now - Time.now => Time.now() - Time.now() > > Time.now -Time.now => Time.now(-Time.now()) > > Similarly, > > Time.now - 1 => Time.now() - 1 > Time.now -1 => Time.now(-1) Indeed. Now I understand. minus (-) is interpreted as a binary object when preceded by object. When preceded by a method name and parentheses are omitted, it is interpreted as a unary operator acting on the object that follows it. There is nothing special about Fixnum or String, here is an example with Time: $ irb >> t1 = Time.now => Wed Apr 14 15:11:33 -0700 2010 >> t2 = Time.now => Wed Apr 14 15:11:41 -0700 2010 >> t2 -t1 => 7.682178 Whew. Thanks everyone! Sarah -- Posted via http://www.ruby-forum.com/.