Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
To iif or not to iif = .t.
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00513276
Message ID:
00514507
Views:
10
Jim,

>Acknowledging that your example is overly simplified, it's just fine for the LOOP condition (I would code the simpler cases this way too) but not so good for EXIT, as it essentially makes a forced completion of the WHILE. This could be very wasteful if processing records and there are more that satisfy the WHILE.
>
>After your last I went on a brief search using GOOGLE to check out 'structured programming loop exit'. What was there was generally older (pertaining to when LOOP/EXIT (or similar) were introduced into various languages). Most entries said that they (LOOP/EXIT) were added to facilitated structured programming! A couple acknowledged that some contended that this was not in keeping with structured programming, but they seemd definitely in the (very) minority.
>
>It tended to confirm in my mind that their usage was perfectly acceptable.
>
It should be pointed out that even the ISO Pascal Standard included the GOTO statement. I'm am of the opinion that its inclusion was an acknowledgement that it it may not be possible in all situations. To quote from the Third Edition of the User Manual and Report:

"A goto statement should be reserved for unusual or uncommon situations where the natural structure of the algorithm has to be broken. A good rule is to avoid the use of jumps to express regular iterations and condition execution of statements, for such jumps destroy the reflection of the structure of computation in the textual (static) structures of the program. Moreover, the lack of correspondence between the textual and computational (static and dynamic) structure is extremely detrimental to the clarity of the program and makes the task of verification much more difficult. The presence of goto's in a Pascal program is often an indication that the programmer has not yet learned "to think" in Pascal (as the goto is a necessary construct in some other programming languages)." - Kathleen Jensen/Niklaus Wirth
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform