From: Matthew Kerwin Date: 2013-03-12T17:34:43+09:00 Subject: Re: Confusion with empty block printing --bcaec54b48d07f9e1904d7b628b2 Content-Type: text/plain; charset=ISO-8859-1 Note that one of my points was that the following are the same: print {} print do end See also: 5.times { } 5.times do end But this is different: print nil, {} Also, ruby method calls have optional parentheses: 3.inspect 3.inspect() foo foo() print 'x' print( 'x' ) The interpreter always reads curlies {} as a block unless it makes no sense to do so. Parens and commas make it clear it's a variable (and thus a Hash). Sent from my phone, so excuse the typos. --bcaec54b48d07f9e1904d7b628b2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

Note that one of my points was that the following are the same:

=A0=A0=A0 print {}
=A0=A0=A0
=A0=A0=A0 print do
=A0=A0=A0 end

See also:

=A0=A0=A0 5.times { }
=A0=A0=A0
=A0=A0=A0 5.times do
=A0=A0=A0 end

But this is different:

=A0=A0=A0 print nil, {}

Also, ruby method calls have optional parentheses:

=A0=A0=A0 3.inspect
=A0=A0=A0 3.inspect()

=A0=A0=A0 foo
=A0=A0=A0 foo()

=A0=A0=A0 print 'x'
=A0=A0=A0 print( 'x' )

The interpreter always reads curlies {} as a block unless it makes no se= nse to do so. Parens and commas make it clear it's a variable (and thus= a Hash).

Sent from my phone, so excuse the typos.

--bcaec54b48d07f9e1904d7b628b2--