Author |
Message |
greenapplesodaex
|
Posted: Tue Jun 08, 2004 8:48 pm Post subject: how do i stop a procedure? |
|
|
Can I exit a procedure like exiting a loop? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
aside
|
Posted: Tue Jun 08, 2004 8:49 pm Post subject: (No subject) |
|
|
use return. |
|
|
|
|
|
greenapplesodaex
|
Posted: Tue Jun 08, 2004 8:53 pm Post subject: reply |
|
|
so... if i use return, will the program still shut down?
it said
procedure double
if errorHasOccurred then
return % Terminate this procedure
end if
"¦ handle usual case in this procedure "¦
end double
what's "errorHasOccurred", turing gave me an error on that |
|
|
|
|
|
aside
|
Posted: Tue Jun 08, 2004 8:57 pm Post subject: (No subject) |
|
|
or you can use "exit" if you are using a loop, if you are not sure. personally i have never use return before, i always use exit |
|
|
|
|
|
greenapplesodaex
|
Posted: Tue Jun 08, 2004 9:08 pm Post subject: reply |
|
|
i know how to exit a loop
i'm asking how to stop a procedure
take a look at this code, can you tell me y it doesnt work?
var errorOccurred : boolean := false
procedure double
if Error.Last = eNoError then
else
errorOccurred := true
put "error"
end if
if errorOccurred = true then
put "error"
return
end if
end double
for i : 1 .. 300
double
colour (i)
double
put i, " " ..
double
end for |
|
|
|
|
|
TheZsterBunny
|
Posted: Thu Jun 10, 2004 5:25 pm Post subject: (No subject) |
|
|
use return.
imagine your procedure like a loop.
now sub exit for return
its like the result command in functions. it quits the procedure, and continues along the mainline. if you use return not in a procedure, it quits your prog.
-Z |
|
|
|
|
|
|