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

Username:   Password: 
 RegisterRegister   
 procedures in procedures/functions/process
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
equs




PostPosted: Thu Apr 08, 2004 8:36 pm   Post subject: procedures in procedures/functions/process

im having a problem.IM trying to make a frid for my game Snake and i cant declare proc or functions or processes in my array. I heard you can call procedures inside a procedures and etc. Does anyone know the comand and how to do this?
ty
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Thu Apr 08, 2004 8:54 pm   Post subject: (No subject)

u are trying to call a futtion in a array? Eh

arrays are things that holed more then one of the same data type and futtions are like miny progames. so u can't put fucttions in arrays.

u call a procedure in a procedure the same way u whould a procedure that is not in a procedure. just do not put the code for a procedure in a procedure, put it above it like u ushely whould
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Delos




PostPosted: Thu Apr 08, 2004 9:03 pm   Post subject: (No subject)

I believe that the poster is saying this:

code:

procedure one
procedure two
end two
end one


This is not possible in Turing. Do not attempt to do it. Arrays work like this:


var nameOfArray : array 1..# of [type]


Procedures:


procedure procName
[contents]
end procName


More info?
Rite here.
http://www.compsci.ca/v2/viewtopic.php?t=407
Catalyst




PostPosted: Thu Apr 08, 2004 9:10 pm   Post subject: (No subject)

you actually can have arrays of functions Very Happy

code:

fcn test1 () : int
    result 1
end test1
fcn test2 () : int
    result 2
end test2
fcn testThree () : int
    result 3
end testThree

var fcnArray : array 1 .. 3 of fcn test () : int

fcnArray (1) := test1
fcnArray (2) := test2
fcnArray (3) := testThree

for i : 1 .. 3
    put fcnArray (i) ()
end for


probably not was he needs tho
equs




PostPosted: Thu Apr 08, 2004 9:24 pm   Post subject: (No subject)

i misspelled it. IM not trying to call functions in arrays but like proceudre sin procedures and functins in procedure and so forth and so forth
AsianSensation




PostPosted: Thu Apr 08, 2004 10:47 pm   Post subject: (No subject)

Catalyst wrote:
you actually can have arrays of functions Very Happy


Shocked Shocked Shocked Shocked Shocked Shocked Shocked Shocked Shocked Shocked Shocked Shocked Shocked Shocked Shocked Shocked


Fo' the Shiznit?!?!?!?!?!

that is pretty cool.

Though do you have to initialize the array of functions like that? (Just can't be satisfied Razz )
Tony




PostPosted: Fri Apr 09, 2004 12:13 am   Post subject: (No subject)

eh? Confused well this is exactly how turing's GUI works. You know how you specify which procedure gets called when you create a button? That procedure gets passed as an argument and is saved in one of internal variables of the button module (or w/e GUI element).

In fact - you could write and export a method that could change the procedure to be called, so same button could do multiple functions depending on various conditions
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
equs




PostPosted: Fri Apr 09, 2004 11:40 am   Post subject: (No subject)

but can i call procedures in procedures. Is there a command? or like functions in procedures. Beucase i have a button and when i pres start the game is suppoed to start which is snake. And i cant make the grid without functions or processes or procedures. And i have to cal them inside the start button procedures so the game wil start. Any help?
ty Joshua
Sponsor
Sponsor
Sponsor
sponsor
Catalyst




PostPosted: Fri Apr 09, 2004 12:37 pm   Post subject: (No subject)

like this?

code:


proc GridSomthing

end GridSomthing


proc Start

    GridSomthing
end Start
equs




PostPosted: Sun Apr 11, 2004 11:49 am   Post subject: (No subject)

no something like this
procedure start
code with procedures/functions/processes
end start
start button code

whenever i try to put procedures/functions/processes in a procedure it says it has ot be at the monitor level. Is there a comand i can call procedures in procedures and so forth or at least put them in 1 procedure?
Catalyst




PostPosted: Sun Apr 11, 2004 12:14 pm   Post subject: (No subject)

why do want other procedures in another procedure?
AsianSensation




PostPosted: Sun Apr 11, 2004 1:46 pm   Post subject: (No subject)

if you really want to do procedures in another procedure, use modules, it's not technically proc in proc, but it's close enough. Though I agree with Catalyst, why would you?
Tony




PostPosted: Sun Apr 11, 2004 2:37 pm   Post subject: (No subject)

the reason you can't declear a procedure within another procedure is because each time that outter procedure is called, inner one would have to be decleared again Confused But even if you could do that, I fail to see the reasoning behind it...
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
equs




PostPosted: Sun Apr 11, 2004 7:18 pm   Post subject: (No subject)

the reason is that i have a start button on a menu screen. Its a sanke game. When i press the start button the game is supposed to start. When the game start all the code should start. Now the button has a procedure. And the game has a procedure. So i have to call procedures for the game inside the start button procedure. Ill look into modules. But if anyone can figure this out it would be helpful.
ty Joshua
Catalyst




PostPosted: Sun Apr 11, 2004 7:27 pm   Post subject: (No subject)

calling a procedure inside another isnt the same as declaring it inside another
why wouldnt something like this work?

code:



%% intro goes here

proc game
   %%Game goes here
end game


proc start
   game
end start
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 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: