Author |
Message |
charlie56
|
Posted: 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
|
|
|
StarGateSG-1
|
Posted: 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
|
Posted: 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
|
Posted: 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
|
Posted: 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
|
Posted: 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
|
|
|
|
|
|