From: Jacob Fugal Date: 2005-04-12T01:53:35+09:00 Subject: Re: How should this really be coded in the Ruby style? On Apr 9, 2005 12:08 AM, Glenn Smith wrote: > Interesting how everybody picks up on the 'unless this do this' or 'do > this unless' code. I also played with a number of styles for these. > My thoughts were that I wanted to put 'what would happen usually' > first, and 'what would happen if it failed' second. ie. > > 'do this but if it fails do that' > > or > > 'if !save then raise' > > On the other hand I like the tidier English of 'raise unless save'. You can have the best of both worlds with 'or'. save or raise "Couldn't save!" This only works if save always returns a true value for success and false value for failure (which from your examples, it looks like it does). Jacob Fugal