gaslouk
Full Member
Hi from beautiful Greece.
Posts: 130
|
Post by gaslouk on Feb 21, 2023 4:15:59 GMT -5
Hi
How works?
Thanks' Gaslouk
|
|
|
Post by Rod on Feb 21, 2023 8:00:09 GMT -5
Ah, simple....
FOR [IF [NOT(] condition [)] THEN EXIT FOR] code [IF [NOT(] condition [)] THEN EXIT FOR] NEXT
WHILE [NOT(] condition [)] [IF [NOT(] condition [)] THEN EXIT WHILE] code [IF [NOT(] condition [)] THEN EXIT WHILE] WEND
DO [[WHILE] [UNTIL] condition] code LOOP [[WHILE] [UNTIL] condition]
Not sure you would ever need EXIT DO or if it exists. The trick is to focus on the code and choose the loop that gives the cleanest execution or non execution of the code within the loop. So do you want it done once then check or check before you do it. choosing the correct loop can avoid the need for EXIT code. DO LOOP is probably the most flexible structure and the least used!
|
|
|
Post by tsh73 on Feb 21, 2023 12:38:10 GMT -5
Yes it does exist I use it regularly as in
inStr$="Hello there again!" do while 1 i=i+1 w$=word$(inStr$, i) if w$="" then exit do print i, w$ loop
|
|
|
Post by Rod on Feb 21, 2023 12:57:43 GMT -5
inStr$="Hello there again!” i=1 w$=word$(inStr$,i) do while w$<>”” print i, w$ i=i+1 w$=word$(inStr$,i) loop
No exit code but some set up.
|
|
|
Post by tsh73 on Feb 21, 2023 14:48:09 GMT -5
There is more then one way to skin a cat. But having a choice is better then not having it.
|
|