Subject | Loop: exit through 'label' + 'leave' or through 'break' |
---|---|
Author | Jeroen W. Pluimers (mailings) |
Post date | 2001-06-07T05:48:14Z |
> To: IB-Architect@yahoogroups.com; 'IB-Architect@yahoogroups.com'Please do not post to the list twice.
> (Minor note: the original Pascal did not contain a return, leadingI think you are confusing BASIC (which didn't have a GOSUB/RETURN in its
> to idiotic mandatory goto's to get out of a function. Ludicrous.)
first incarnations) with Pascal (which does not have, and does not need a
return).
Anyway, I think being picky about ones favourite languages is completely off
topic. This list is about Interbase and the underlying language. It is a
given fact that the Interbase language stems from many origins, which is
something we have to live with.
With respect to the Interbase language, and my experience that the majority
of todays coding is maintenance, I think we should focus on maintainability
things (like readability, and being able to hand over code to others without
worrying they won't understand).
Keeping that in mind, it is important to focus on gaining functionality, but
keeping the degrees of freedom to a minimum.
The requested functionality is being able to leave a loop early in a
determined way. This already introduces a degree of freedom, which makes
maintainability harder. But it also adds some functionality that, when used
with care, can be very powerful.
The possible extra degrees of freedom are being able to leave to a multitude
of places or exit a multitude of loops.
Keeping that in mind, I would opt for the 'break' solution.
--jeroen