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:
00514235
Views:
11
George,

>>>>SNIP
>>>>>
>>>>>I think George Tasker hit the nail on the head in an earlier message: that he considers them the equivalent of GOTO in Basic - with all the problems that causes.
>>>>>
>>>>C'mon Al, it's nothing of the sort.
>>>>
>>>>Goto can end up anywhere while LOOP goes to only one place and EXIT goes *only* to the place that you are going to go to anyways. There's a HUGE difference.
>>>>I'm not arguing against your personal standard, just the justification you (and George) use for this particular one.
>>>
>>>Whoa there, bucko. First, you do know where a GOTO will end up: either at the line number or line label. Second, the objection to it and EXIT and LOOP is exactly the same. It leads to un-structured code that's more difficult to both read and maintain.
>>
>>Now now, George, you know what I meant.
>>
>>Yes, a GOTO goes to a line number which can be ANYWHERE (and that can lead to another GOTO which can later lead to another GOTO ad infinitum, in a spaghetti-like fashion).
>>
>>A LOOP goes to the TOP of the sole iteration process where it is coded. A EXIT goes out (to the bottom) of the sole iteration process where it is coded, which also happens to be the exact same place that the iteration will go when it is completed naturally.
>>
>>A GOTO definitely leads to unstructured code. A LOOP or EXIT does NOT lead in any way, shape or form to unstructured code. Since I have read you say that you use approximately 20 lines as your "standard" for coding any process I can hardly see where a LOOP or an EXIT would be difficult to discern or lend non-structure to your code.
>>
>>As I said to Al D., I don't argue with your personal standard.
>>
>>If you were to look at LOOP or EXIT as just a shorthand for an IF statement, which seems a legitimate viewpoint to me, then there is no real difference - both result in specific code being bypassed. And at least LOOP and EXIT do exactly what their words *mean*. The CONTINUE command sure doesn't (in my humble opinion).
>>
>>Cheers
>>
>Jim,
>
>It is unstructured since changes the normal logical flow the code, like GOTO does. Sure LOOP goes to the top of iteration structure, and EXIT to the line immediately preceeding. In both cases, however, they can make maintaining the code more difficult, since they corrupt the logical sub-ordination of the indentation structure. And there's no arguing about this, since that's the purpose of indentation.

I wasn't aware that indentation was the definition of "structured code". I yield - you are correct.

I will pay the price when necessary because my personal preferences are (as regards this):
1) readable code;
2) code that does not 'force' a condition (counter beyond value or condition now obviated) WITHIN A STRUCTURE (this is a problem in waiting);
3) code that does not continue to process the loop condition when it is no longer necessary (IF condition(s) detects nothing more required so they do nothing but allow the natural loop to complete). This is just wasteful.

Your preferences are what they are and mine are too. They both end up with working programs.

Regards,

JimN
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform