Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 how do i stop a procedure?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
greenapplesodaex




PostPosted: 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
Sponsor
sponsor
aside




PostPosted: Tue Jun 08, 2004 8:49 pm   Post subject: (No subject)

use return.
greenapplesodaex




PostPosted: 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




PostPosted: 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




PostPosted: 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




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: