--31zvzas5NXT9fief Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Ben Giddings (bg-rubytalk / infofiend.com) wrote: > Michael Geary wrote: > >Suppose you have zero quarts of milk in your refrigerator. I am visiting > >and > >I ask: > > > >Got milk? > > if (milk_qty == 0) > puts "no" > else > puts "yes" > end I prefer: unless milk_qty.zero? then puts "Darn-tootin!" else puts "Shucks, all out!" end Ruby provides nice explicit "boolean-test" methods for you, thinks like #nil?, File.exists?, Numeric#zero?, #respond_to?, Array#include?, etc. that give you something nice and readable. -- Eric Hodel - drbrain / segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --31zvzas5NXT9fief Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQFAq6A1MypVHHlsnwQRAv3JAJ4wX/8k8uL8sNo0QWEG7Cc+wl1QwgCg5sk6 tOZCvdFL2vLq6eOfo7tIH9kB -----END PGP SIGNATURE----- --31zvzas5NXT9fief--