Alex Shulgin
4/22/2008 6:05:00 AM
On Apr 21, 11:39 am, Eric Hodel <drbr...@segment7.net> wrote:
> On Apr 20, 2008, at 13:25 PM, Alex Shulgin wrote:
>
>
>
> > Hi,
>
> > Anyone aware of this bug?
>
> > $ cat expr-bug.rb
> > a = (2
> > + 2) / 2
> > p a
>
> > a = (2 > > + 2) / 2
> > p a
> > $ ruby expr-bug.rb
> > 1
> > 2
> > $ ruby --version
> > ruby 1.8.6 (2008-03-03 patchlevel 114) [x86_64-linux]
>
> This is not a bug. Newlines are significant in ruby.
Yes, I realize now.
But I'd better expect a syntax error like `expecting ')', but found
newline'. Instead of that, the code runs but produces quite
unexpected results and the problem isn't easy to spot if you are not
familiar with this issue.
I think I can get used to break lines after the operator or use a
backslash... My problem is that I've already used to break lines
_before_ operator in C. ;-)
--
Thank you all,
Alex