Post Reply 
STRINGFROMID and gradians
09-22-2018, 02:37 PM (This post was last modified: 09-22-2018 02:41 PM by Tyann.)
Post: #26
RE: STRINGFROMID and gradians
(09-21-2018 05:47 PM)StephenG1CMZ Wrote:  Maybe I'm wrong - I don't use EXIT often.

But
Code:

For i from 1 to 9
For j from 1 to 9
 EXIT(2)
End
End
Here:
Msgbox("ok")
I would expect to reach Here OK.

Now surround that working code with an additional for loop:

For newloop from 1 to 9
For i from 1 to 9
For j from 1 to 9
EXIT(2)
End
End
MSGBOX("are we there yet? Why not")
End
Here: MSGBOX("ok we have failed")

Simply surrounding previously working code with a trival for loop breaks the working code, unless you hunt through all your code fixing exits (in this example 1 extra for means changing 1 exit(2) to exit(3), I think, though I haven't debugged all the code to be certain).

Now, replace exit(2) or exit (3) with goto here:

Now, you don't have to edit all those exits every time you write a for loop.
Your code will reach here whether you have two for loops, or have written a third ok.

It could be I have misunderstood how EXIT works, but a GOTO looks like MUCH less effort.
Update: In PPL its BREAK or CONTINUE, apparrently, not EXIT - Thanks Cyberangel.

Bonjour
Dans ce cas il peut-être utile d'utiliser une variable, il suffira de modifier la valeur de cette variable plutôt que tous les BREAK.
De plus vous pourrez si vous avez plusieurs points de sortie les repérer grâce à un commentaire.


Hello
In this case it may be useful to use a variable, it will be enough to modify the value of this variable rather than all the BREAKs.
Moreover you will be able if you have several points of exit to locate them thanks to a comment.

exemple :

Code:

Local  A:=1,B:=2;
FOR i FROM 1 TO 10
 FOR j FROM 1 TO 20

    IF 'condition1' THEN BREAK(A) END;
    IF 'condition2' THEN BREAK(B) END; 
 END;//for j
 // sortie A

END;//for i
// sortie B

Sorry for my english
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: STRINGFROMID and gradians - roadrunner - 09-18-2018, 03:46 PM
RE: STRINGFROMID and gradians - roadrunner - 09-18-2018, 04:22 PM
RE: STRINGFROMID and gradians - CyberAngel - 09-18-2018, 04:39 PM
RE: STRINGFROMID and gradians - roadrunner - 09-18-2018, 05:09 PM
RE: STRINGFROMID and gradians - Tyann - 09-19-2018, 05:02 AM
RE: STRINGFROMID and gradians - CyberAngel - 09-19-2018, 03:53 PM
RE: STRINGFROMID and gradians - CyberAngel - 09-19-2018, 04:10 PM
RE: STRINGFROMID and gradians - toml_12953 - 09-20-2018, 05:52 PM
RE: STRINGFROMID and gradians - CyberAngel - 09-20-2018, 05:58 PM
RE: STRINGFROMID and gradians - CyberAngel - 09-21-2018, 04:49 PM
RE: STRINGFROMID and gradians - Tyann - 09-22-2018 02:37 PM
RE: STRINGFROMID and gradians - CyberAngel - 09-21-2018, 09:04 PM



User(s) browsing this thread: 2 Guest(s)