Computer Science Canada declaring a procedure in a procedure |
Author: | be natural* [ Sun Jun 01, 2003 7:34 pm ] |
Post subject: | declaring a procedure in a procedure |
Is it possible to declare a procedure in a procedure? Not calling for it, but declaring... |
Author: | Tony [ Sun Jun 01, 2003 7:37 pm ] |
Post subject: | |
why would you want to declear a procedure inside a procedure? Thats just doesnt make any sence... each time that procedure is called, the same one inside it is decleared over and over again. |
Author: | be natural* [ Sun Jun 01, 2003 7:45 pm ] |
Post subject: | |
because i have this problem... there are 5 procedures and i will call them 1,2,3,4 and 5 inside the procedure 1, i'm calling 2 and 4 in the procedure 2, i'm calling 1 and 2 in the procedure 3, i'm calling 2 in the procedure 4, i'm calling 1 and 5 in the procedure 5, i'm calling 4 if i do this, this won't run because when i'm calling 2 in 1 then 2 has to be declared before 1 and when i also call 1 in 2 then it has to be before 2 which can't be done how can i solve this out |
Author: | PaddyLong [ Sun Jun 01, 2003 7:47 pm ] |
Post subject: | |
I would say you need to think of a different way... a driver procedure that will have the logic to call any of the procedures based on something that may happen within one of the procedures or whatever... might I ask exactly what you're trying to do here? like what kidn of program? |
Author: | be natural* [ Sun Jun 01, 2003 7:54 pm ] |
Post subject: | |
i'm making a bubble shooting game and this is the part where i'm controling the arrow that shoots the bubble. so the first procedure draws the arrow that is pointing right up, and if i press right arrow then it will call the procedure that rotates the arrow to the right, and if i press left arrow then it will call the procedure that rotates the arrow to the left........so on and so forth @_@~ |
Author: | PaddyLong [ Sun Jun 01, 2003 7:59 pm ] | ||
Post subject: | |||
yeah, definately have a seperate driver procedure that is getting all of your keyboard input and calling the rotate procedures... something like
|
Author: | be natural* [ Sun Jun 01, 2003 8:08 pm ] |
Post subject: | |
i don't really get it can u explain a bit more? thx |
Author: | Catalyst [ Sun Jun 01, 2003 8:09 pm ] |
Post subject: | |
forward lets you use procedures like that (all meshed together) look it up in help for more info[/code] |
Author: | wrectify [ Wed Jun 04, 2003 1:02 pm ] |
Post subject: | |
why can't you just use a process and fork? |
Author: | krishon [ Wed Jun 04, 2003 1:34 pm ] |
Post subject: | |
ye, lol, that's a good question, process and fork shouldn't be too hard |
Author: | Blade [ Wed Jun 04, 2003 10:29 pm ] | ||
Post subject: | |||
processes i consiter bad programming, because it lags like a freak. so i would not reccomend using processes... but calling a procedure from inside another procedure will work but of course the procedure you are calling has to be written above the other... like this:
|
Author: | Catalyst [ Wed Jun 04, 2003 10:47 pm ] | ||
Post subject: | |||
processes are a lazy and dirty way to program (at least in turing's case) here how you would do procs that are intertwined
|