From: James Edward Gray II Date: 2005-06-21T03:20:26+09:00 Subject: Re: :Another Newbe question ..." if then syntax" On Jun 20, 2005, at 1:10 PM, Chuck Brotman wrote: > some cinfusion on syntax... > > Is it necessary (desirable) to end a single-line if/then statement > with > "end. Usually, but read on. > The dopcumentation shows it when using else or multiline if.. > > Is the following okay?: > > if condition then "the then code" No, that's not okay. However, Ruby allows statement modifiers, so we can reverse that: do_this() if condition? That is allow and no end is needed. > or should it be > > if condition then "the then code" end ???? The above is fine. You can also replace then with it's symbol shortcut, in recent versions of Ruby: if condition? : do_this() end > what about the use of curlybrackets "{}" how would that syntax go? No braces for if's, use end instead. Hope that helps. James Edward Gray II