RE: Declaring a Function Before it is used
- Posted by Tommy Carlier <tommy.carlier at pandora.be> Oct 28, 2003
- 447 views
> Can anyone tell me if there is a way to declare a function before it > is used. > > If not, how do you handle things like: > Run Function A, which calls Function B > Function B calls Function C > If statement then > Function C calls Function D > else > Function C calls Function A > end if > > This seems impossible to handle if you can't declare Function A ahead of > time, because you can't move it ahead of Function C to solve the > problem, > since that causes a problem of not being able to call Functions B and C > from > Function A If I need something like this, I use routine_id: integer Callee_routine_id procedure _Callee(int x) call_proc(Callee_routine_id, {x}) end procedure procedure Caller() -- 'Caller' needs to call 'Callee' _Callee(15) -- instead of calling Callee, you call _Callee end procedure procedure Callee(int x) -- do something with x end procedure Callee_routine_id = routine_id("Callee")