need if section help for ISP
Author |
Message |
person
|
Posted: Tue Jan 11, 2005 7:32 pm Post subject: need if section help for ISP |
|
|
How do i get the code to stop by not using "quit" or "Window.Close" when (something) happens? Thanks for reading!
if (something) then
(do not continue to the rest of the code)
end if |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Cervantes
|
Posted: Tue Jan 11, 2005 8:21 pm Post subject: (No subject) |
|
|
If that if statement is inside a loop, you could use exit to quit the loop. Mind you, anything after that would still be executed. To get around that, you could use a flag (boolean) variable like this:
code: |
var flag := false
loop
if condition = true then
flag := true
end if
exit when flag
end loop
if flag = false then
loop
%more stuff
end loop
end if
|
Another thing you could do is:
code: |
if condition = true then
loop
end loop
end if
|
And you can stall your program forever. Yay. I don't really know why you wouldn't want to use quit or Window.Close, however. |
|
|
|
|
|
Tony
|
Posted: Tue Jan 11, 2005 9:54 pm Post subject: (No subject) |
|
|
I think the easiest (and what makes most sence) is to just have the function return a value. It doesn't have to mean anything, I used to use return 0; as breaks in code
anyways, turing is backwards, you have to use result instead. |
|
|
|
|
|
|
|