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

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




PostPosted: Sat Jan 16, 2010 9:35 am   Post subject: Procedure within procedures??

What is it you are trying to achieve?
I am trying to use procedure within procedures

What is the problem you are having?
When I do make procedures within procedures, it says that "Procedure can only be made at "Module" or "moniter level" ?


Describe what you have tried to solve this problem
<I've heard about using functions, but I am not really sure how to use them>


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


Turing:






Please specify what version of Turing you are using
<Turing 4.0.3>
Sponsor
Sponsor
Sponsor
sponsor
ProgrammingFun




PostPosted: Sat Jan 16, 2010 10:01 am   Post subject: Re: Procedure within procedures??

Yes, a procedure cannot be created within another procedure. But you can create that procedure before the other and then call to it in your second procedure:

Turing:


% an example

procedure A
put A

end A

procedure B %You want procedure A to work in here
put B

% call to procedure A

end B



Hope this helps but if not, you can refer to http://compsci.ca/v3/viewtopic.php?t=23611 for a great way solve your problem
Rampragash




PostPosted: Sat Jan 16, 2010 11:16 am   Post subject: RE:Procedure within procedures??

oh ic Thnxx

um..do u know anyway that i can group different procedures together by any chance?
ProgrammingFun




PostPosted: Sat Jan 16, 2010 11:36 am   Post subject: RE:Procedure within procedures??

what do you mean?

You can group them together by doing the following:

Turing:


procedure A % proc 1
put "A"
end A

procedure B % proc 2
put "B"
end B

procedure AandB % they are grouped together in proc 3
A
B
end AandB



or to make them occur at the "same time":

Turing:


procedure A % proc 1
put "A"
end A

procedure B % proc 2
put "B"
end B

procedure AandB % they are grouped together in proc 3

loop
A
B
end loop

end AandB

Rampragash




PostPosted: Sat Jan 16, 2010 12:42 pm   Post subject: RE:Procedure within procedures??

oh i get it now!

thanks, that was very helpful!!!
the reason y i asked was, cos im making like 6 quiz screens and i need them in two sets Smile
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  [ 5 Posts ]
Jump to:   


Style:  
Search: