Computer Science Canada Turing Script Help (urgent) |
Author: | MikeAlexnder [ Sat Dec 20, 2008 2:49 pm ] | ||||
Post subject: | Turing Script Help (urgent) | ||||
Can someone help me fix this code I can't run it because of the function and procedure and I need it Mod Edit: No need for excessive caps. Also remember to use syntax tags
|
Author: | TheGuardian001 [ Sat Dec 20, 2008 5:03 pm ] | ||
Post subject: | Re: Turing Script Help (urgent) | ||
1) Use code/syntax tags
anyway, your problem is that you can't declare functions/procedures inside of a case/if structure. Move the procedure and function out of the case and it should be fine, provided the code works properly. |
Author: | MikeAlexnder [ Sat Dec 20, 2008 7:55 pm ] |
Post subject: | RE:Turing Script Help (urgent) |
How do you do that? Can you send the edited script? (The program works if I remove case but I need it so I can't get rid of it) |
Author: | TheGuardian001 [ Sun Dec 21, 2008 1:07 pm ] | ||||
Post subject: | Re: Turing Script Help (urgent) | ||||
What I mean by that is to literally take the section of code that is inside a function/ procedure and move it outside of the case statement. what you have now:
when I say to take them out of the case statement, I mean that it should be
|
Author: | MikeAlexnder [ Sun Dec 21, 2008 1:35 pm ] |
Post subject: | RE:Turing Script Help (urgent) |
If I do that then how would I be able to create a menu for my program. |
Author: | Tony [ Sun Dec 21, 2008 2:24 pm ] |
Post subject: | RE:Turing Script Help (urgent) |
Easily. Because the menu and the logic (functions and such) are separate. |
Author: | MikeAlexnder [ Tue Dec 23, 2008 1:16 pm ] |
Post subject: | RE:Turing Script Help (urgent) |
Need more help!!! |
Author: | MikeAlexnder [ Tue Dec 23, 2008 1:16 pm ] |
Post subject: | RE:Turing Script Help (urgent) |
Can't I combine them? |
Author: | Tony [ Tue Dec 23, 2008 1:42 pm ] |
Post subject: | RE:Turing Script Help (urgent) |
There is no need to. As TheGuardian001 said above, simply move all of your functions and procedures to the top of your program. The code is not run until it's called, and it will still be available from your case block. |
Author: | MikeAlexnder [ Tue Dec 23, 2008 7:04 pm ] |
Post subject: | RE:Turing Script Help (urgent) |
oh ok |