forums

TNT Basic Forums > Programming Q&A
Exiting a procedure
< Last Thread     Next Thread >
Author
Thread        Post A Reply

03-22-2002 18:05

Posted by:
Louis!

Find more posts by Louis!

Is there a nice easy way to exit a procedure, I tried calling an end Proc before the end of tthe procedure, but that doesn't work... I thought of simply calling the procedure that called the procedure in the first place, but that will reset the calling procedure, I want to be able to exit a procedure prematurely and haev the code continue from where I called the procedure.. you get it?

03-22-2002 23:08

Posted by:
Mark Tully

Find more posts by Mark Tully

There's no specific method for returning from a procedure early. You could put a label at the end of the procedure and then use a goto statement?

procedure test()

...blah
goto stop
...blah


stop:
end proc

Mark

03-23-2002 22:17

Posted by:
Louis!

Find more posts by Louis!

Thanx a bundle!

03-25-2002 08:44

Posted by:
Scoops

Find more posts by Scoops

How about adding a RETURN command to cope with these situations?

03-27-2002 21:03

Posted by:
Mark Tully

Find more posts by Mark Tully

return

Yeah we need that, I'll add it to our todo list.

Thanks

Mark

09-14-2002 15:09

Posted by:
Mark

Click Here to Email Mark   Find more posts by Mark

Proc. name errors

I keep getting 'a procedure cannot be declared inside another procedure' errors when I try to run my code, does anyone know how I can get around them?

e.g.
MovePlayer()
Procedure MovePlayer()
.....
end proc

Fire()
Procedure Fire()
.......
end proc

In these the parethasis in the procedure definition would be highlighted as an error. As you can see there are no spaces and I have tried deleting them, but this only causes more errors!
Any help appreciated.

09-14-2002 23:11

Posted by:
Mathew

Find more posts by Mathew

I guess you may not put parenthesis when you call it.


>e.g.
>MovePlayer()
>Procedure MovePlayer()
>.....
>end proc
>
>Fire() ******HERE'S THE PROBLEM******
>Procedure Fire()
>.......
<end proc

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.