
-----------------------------------
Ktomislav
Fri Sep 12, 2008 4:50 pm

Calling procedures
-----------------------------------
To be clear, here is the code. And please tell me why isn't it working.

procedure p1
    p2
end p1
procedure p2
    put "Hello"
end p2

p1


-----------------------------------
Tony
Fri Sep 12, 2008 5:18 pm

RE:Calling procedures
-----------------------------------
because when p1 calls p2, p2 has not been decleared yet, so it doesn't know about it (procedural programming and all that).

You can rearrange the order of procedures, but sometimes you might get loops. There's a forward keyword and function prototyping that solves that problem.

-----------------------------------
Ktomislav
Fri Sep 12, 2008 5:25 pm

Re: Calling procedures
-----------------------------------
Thanks a lot! I just couldn't find out how to do that.
