From: Patrick Hurley Date: 2005-04-01T22:17:49+09:00 Subject: Re: && Syntax On Apr 1, 2005 6:29 AM, Lyndon Samson wrote: > Yes, I'm a rube-noob > > -- ok > if 1 == 1 && > 2 == 2 > puts "TRUE" > end > > -- syntax error > if 1 == 1 > && 2 == 2 > puts "TRUE" > end > > The second form is more convienient as you can easily comment out the > line, but it causes a syntax error. > > I guess the interpreter need to know where the conditional finishes > and the statements begin? > Ruby has a very relaxed parser -- that often (unlike C/Java/etc) uses EOL to delimit expressions. If the parser scans an obvious hanging statement (like the &&) it will determine that the expression spans to the next line. You can use the \ to force the span. If you are after a format that allows for easy commenting out of lines try: if expr && expr && expr && true p true end Patrick