Computer Science Canada

How do I declare a function / procedure before I create it?

Author:  Fexter [ Mon Jan 30, 2012 5:02 pm ]
Post subject:  How do I declare a function / procedure before I create it?

What is it you are trying to achieve?
In my program, I have a procedure that needs to use things that are below where it's being called from. Right now, this would cause an error, no matter where I place it. So, I'd like to be able to declare it before I create the procedure, create what I need to call from the procedure, then create the procedure itself. I think there's a way to do this, but I'm not sure what the way is.

What is the problem you are having?
I can't seem to find what code I would have to use, and my code is creating an error without it.


Describe what you have tried to solve this problem
I have tried looking in the Turing Documentation, but haven't found the code needed to do this.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Turing:

% Only a small part of the code - What I want to do with this

% Declaration of procedureName

procedure mainProgram

% The main game program
playGame()
procedureName()

end mainProgram

procedure extraCode
% The code needed for the procedure name
end extraCode

procedure procedureName()
% What the code does
end procedureName



Please specify what version of Turing you are using
I am using Turing 4.1.1.

Author:  Fexter [ Mon Jan 30, 2012 5:56 pm ]
Post subject:  RE:How do I declare a function / procedure before I create it?

I found the code for it - 'Forward' and 'Body.'


: