Why Ruby Is Not My Favourite Programming Language

28th August 2002

Ahem.

There's one wrinkle when while and until are used as statement modifiers. If the statement they are modifying is a begin/end block, the code in the block will always execute at least one time, regardless of the value of the boolean expression.
- David Thomas and Andrew Hunt, Programming Ruby: The Pragmatic Programmer's Guide, section Expressions

And the proof:

	$ cat crud.rb
	print "Hello\n" while false
	begin
	  print "Goodbye\n"
	end while false
	$ ruby crud.rb
	Goodbye
	$
  

Case closed.

Thanks to Steve ``Haldane'' Sykes <haldane1@stephensykes.com> for pointing me at this part of the Ruby documentation.
Feedback to <mike@miketaylor.org.uk> is welcome!