Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Procedure problems
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
packocrayons




PostPosted: Fri Feb 22, 2013 3:37 pm   Post subject: Procedure problems

What is it you are trying to achieve?
Have one procedure call a second procedure and that first procedure call the second


What is the problem you are having?
Second procedure is not declared when the first procedure calls it because second procedure is below first


Describe what you have tried to solve this problem
I have no clue how to


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

Turing:


procedure one
% stuff
two
end one

procedure two
%stuff
one
end two



Please specify what version of Turing you are using
4.1.2 (the newest version)
Sponsor
Sponsor
Sponsor
sponsor
A.J




PostPosted: Fri Feb 22, 2013 3:57 pm   Post subject: Re: Procedure problems

You need to declare procedure two before the implementation of procedure one so that the compiler knows what 'two' in procedure one is referring to. You can do this with a "forward" declaration in Turing:

Turing:

forward procedure two (argument : int)

procedure one
% stuff
var args : int
two(args)
end one

body procedure two
%stuff
one
end two


Note that the implementation of the procedure two doesn't require the arguments' definition, and requires the keyword 'body'.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: