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


Groups > comp.lang.ruby > #6457 > unrolled thread

parentheses and newlines

Started byjsnark <swr@monmouth.com>
First post2012-02-17 06:01 -0800
Last post2012-02-18 20:56 +0100
Articles 3 — 3 participants

Back to article view | Back to comp.lang.ruby


Contents

  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

#6457 — parentheses and newlines

Fromjsnark <swr@monmouth.com>
Date2012-02-17 06:01 -0800
Subjectparentheses and newlines
Message-ID<139b9140-b002-4300-b43a-38db39cab653@bs8g2000vbb.googlegroups.com>
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>'

[toc] | [next] | [standalone]


#6458

FromRobert Klemme <shortcutter@googlemail.com>
Date2012-02-17 16:33 +0100
Message-ID<9q7a9gFe09U1@mid.individual.net>
In reply to#6457
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

[toc] | [prev] | [next] | [standalone]


#6461

FromSimon Krahnke <overlord@gmx.li>
Date2012-02-18 20:56 +0100
Message-ID<87haynhq4i.fsf@xts.gnuu.de>
In reply to#6457
* jsnark <swr@monmouth.com> (2012-02-17) schrieb:

>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>'

Same behaviour in ruby with eval. So no irb problem.

mfg,                simon .... l

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.ruby


csiph-web