Computer Science Canada need if section help for ISP |
Author: | person [ 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 |
Author: | Cervantes [ Tue Jan 11, 2005 8:21 pm ] | ||||
Post 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:
Another thing you could do is:
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. ![]() |
Author: | Tony [ Tue Jan 11, 2005 9:54 pm ] |
Post 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. |