Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #6458

Re: parentheses and newlines

From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.ruby
Subject Re: parentheses and newlines
Date 2012-02-17 16:33 +0100
Message-ID <9q7a9gFe09U1@mid.individual.net> (permalink)
References <139b9140-b002-4300-b43a-38db39cab653@bs8g2000vbb.googlegroups.com>

Show all headers | View raw


On 02/17/2012 03:01 PM, jsnark wrote:
> Can anyone explain the following behavior?  I would expect both
> expressions to fail, but the first unexpectedly succeeds.
>
> $ irb --version
> irb 0.9.6(09/06/30)
> $ ruby --version
> ruby 1.9.2p136 (2010-12-25) [x86_64-linux]
> $ irb
> irb(main):001:0>  (2
> irb(main):002:1>  3)
> =>  3
> irb(main):003:0>  (2 3)
> SyntaxError: (irb):3: syntax error, unexpected tINTEGER, expecting ')'
> (2 3)
>      ^
>          from /usr/local/ruby-1.9.2/bin/irb:12:in `<main>'

irb(main):001:0> (2;3)
=> 3

Line terminator is more than just whitespace.

Kind regards

	robert

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

parentheses and newlines jsnark <swr@monmouth.com> - 2012-02-17 06:01 -0800
  Re: parentheses and newlines Robert Klemme <shortcutter@googlemail.com> - 2012-02-17 16:33 +0100
  Re: parentheses and newlines Simon Krahnke <overlord@gmx.li> - 2012-02-18 20:56 +0100

csiph-web