|
Many years ago, there was a level of fanaticism involving structured
programming, combined with a very primitive understanding of it. It was
exemplified in the inordinate popularity of Pascal, which had no concept
of "LEAVE," and only grudgingly included a GOTO.
This primitive understanding assumed, in particular, that under normal
conditions, an indexed loop always runs to completion, and should only
exit early in case of an irrecoverable error. In fact, there's an
obvious exception to this: table look-up. This led to numerous cases in
which programmers were forced to choose between (1) storing the "found"
value and continuing to waste processor resources iterating uselessly
(perhaps at least skipping the "meat" of the loop), (2) substituting a
DOWHILE or DOUNTIL construct, and handling the counter manually, or (3)
using a GOTO.
It's rather telling that when Niklaus Wirth, the ultimate structured
programming maven, designed a language for actual production use (Pascal
was never intended as more than a teaching language), it *did* have a
"LEAVE" (I don't remember, offhand, what it was called).
At any rate, where GOTO allows transfer of control to any labeled
statement (in some languages, like traditional BASIC, all statements
have labels), possibly even including transferring *into* a loop or
inner-block in a way that bypasses any initialization, LEAVE simply
exits the current iterative structure, going "out" the same way it would
normally exit on completion, while ITERATE simply aborts the current
iteration without actually exiting the loop.
--
JHHL
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.