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

Username:   Password: 
 RegisterRegister   
 Procedure ending
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
charlie56




PostPosted: Thu Apr 07, 2005 9:04 pm   Post subject: Procedure ending

i was wondering if it is possible to end a procedure half way thru it if a certain vaule has been reached in a variable like(i no this wont work just showing wut i mean):

procedure example
if value>20 then
end example
end if
end example

any help would be greatly appreciated thank you.
Sponsor
Sponsor
Sponsor
sponsor
StarGateSG-1




PostPosted: Thu Apr 07, 2005 10:00 pm   Post subject: (No subject)

Well yes it is but not like that, First off if you wnat to get into procedue you need to use forward and body.

code:

Ex.
forward procedure NaN
...
...
...
body procedure NaN
...
...
...
end NaN

All that does is so you can always call a procedure at anytime no more having to have them in order (teachers don't teacher this even though it is easy to learn)

Anyways back to your problem

This is what you did...
code:

procedure example
if value>20 then
end example
end if
end example


This is what it should look like

code:

forward procedure exmaple
...
...
...
body procedure example
if value > 20 then
(CALL ANOTHER PROCEDURE HERE)
end if
end example


Do you undersatnd that???
lordofall




PostPosted: Thu Apr 07, 2005 10:21 pm   Post subject: (No subject)

just use a return statement

code:

procedure example
if value>20 then
   return
end if
end example
StarGateSG-1




PostPosted: Thu Apr 07, 2005 10:24 pm   Post subject: (No subject)

That also works I was asuming that he was going to have it perform an action. Also that is not a very good way! It works really well in other programing languages becasue that is there base, but for turing you stick yourself in endless procedures, It is the best way for noobs.
ssr




PostPosted: Thu Apr 07, 2005 10:49 pm   Post subject: (No subject)

I personally find return not useful, but not yet useless, I find it kinda rude to just stop the program right in the middle.
lol
but return does do something, well, not that much, but does something...
StarGateSG-1




PostPosted: Thu Apr 07, 2005 11:14 pm   Post subject: (No subject)

Return is a part of turing that is a wanabe code, it really shoudln't be there but because Tom is trying to turn it into a better more advanced language slowly.
charlie56




PostPosted: Fri Apr 08, 2005 12:39 pm   Post subject: (No subject)

k thx i got it working now, its a black jack game if u want to take a look at it http://www.compsci.ca/v2/viewtopic.php?t=8367[/url]
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  [ 7 Posts ]
Jump to:   


Style:  
Search: