From: Reimer Behrends Date: 2003-12-15T03:51:59+09:00 Subject: Re: prog for g.c.d. of 2 integers Robert Klemme (bob.news@gmx.net) wrote: > "Michael Campbell" schrieb im Newsbeitrag > news:20031211160102.24728.qmail@web12408.mail.yahoo.com... > > Robert Klemme wrote: > > > begin > > > a,b = b,a % b > > > end while b != 0 > > > > Not trying to "golf", but is the begin/end necessary here? Actually, the begin/end make the above incorrect. It will break down for b = 0. > No. It's a relict from the evoltion process. But you're right > > a,b = b,a % b while b != 0 > > looks much better. :-)) It may look better, but try: fail while false vs. begin fail end while false The first case will not raise an exception, because the while condition is tested at the beginning of the loop, while the second case tests the condition at the end of the loop and raises an exception. Therefore, there is a clear difference in semantics. To make it unambiguous, just use: while b != 0 do a, b = b, a % b end which is probably the clearest way to express what you need. Reimer Behrends