From: darren kirby Date: 2006-09-06T12:24:58+09:00 Subject: Re: One line infinite for loop in Ruby? --nextPart1635671.oIeb6fGrQQ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline quoth the Austin Ziegler: > On 9/5/06, darren kirby wrote: > > I have been wondering, is there a no-op in Ruby? Then you could do like > > in Python: > > > > while 1: pass > > nil while true Cool, thanks. I've just realized you don't even need the 'nil' to flesh out some=20 syntactically valid functions/methods/case statements that do nothing: irb(main):005:0> def foobar irb(main):006:1> end =3D> nil irb(main):010:0> x =3D 1 irb(main):011:0> if x =3D=3D 2 irb(main):012:1> puts "Two!" irb(main):013:1> elsif x =3D=3D 1 # do nothing irb(main):014:1> else irb(main):015:1* puts "Not 1 or 2" irb(main):016:1> end =3D> nil technically they return nil but that is incidental... > -austin =2Dd =2D-=20 darren kirby :: Part of the problem since 1976 :: http://badcomputer.org "...the number of UNIX installations has grown to 10, with more expected..." =2D Dennis Ritchie and Ken Thompson, June 1972 --nextPart1635671.oIeb6fGrQQ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQBE/j9pwPD5Cr/3CJgRAuqMAKCRgz+GTMBNYfCcxrWdZaIvhCxrvQCgnooU v9QUDHDW0V1Id5l0btVyr10= =pXep -----END PGP SIGNATURE----- --nextPart1635671.oIeb6fGrQQ--