
-----------------------------------
marsbarz
Mon Apr 04, 2005 9:55 am

Menus: How to switch back to a processes undeclared??
-----------------------------------
I'm writing this program for my compsci class, and yes, I'm using processes. I know I read the thread on why processes should be avoided but I think in this case it's not really necessary to put everything into a loop because in the end it'll get me the same amount of marks. :P

BUT here is where I might be wrong!

I am actually very new to turing and programming in general and I ran into this little problem while I was writing my program.

I used a process to create a menu screen for the program which would run at the start.

But now that menu has a selection process which has to be declared before the menu so that the menu can utilize the selection (can't run an undeclared process). But now, there is an option on that menu selection process that is supposed to return the user back to the menu if their selection is invalid.

So I'm wondering exactly what I should be doing here? Should I just put everything into a loop somehow (still haven't figured out how I'm going to do that) or is there a method to manipulate the code so I can jump to a process that is otherwise undeclared?

Here is the code specific to my problem, pre-declared variables and stuff not included:
proc menudecision
    getch (menuselect)
    if menuselect = "a" or menuselect = "A" then
        selectiona
    elsif menuselect = "b" or menuselect = "B" then
        selectionb
    elsif menuselect = "c" or menuselect = "C" then
        selectionc
    elsif menuselect = "d" or menuselect = "D" then
        selectiond
    elsif menuselect = "e" or menuselect = "E" then
        selectione
    elsif menuselect = "f" or menuselect = "F" then
        selectionf
    elsif menuselect = "g" or menuselect = "G" then
        selectiong
    elsif menuselect = "h" or menuselect = "H" then
        selectionh
    elsif menuselect = "i" or menuselect = "I" then
        selectioni
    elsif menuselect = "j" or menuselect = "J" then
        selectionj
    else
        cls
        Draw.Text ("The selection you have made is incorrect", 200, 200, system10, white)
        Draw.Text ("Select either A, B, C, D, E, F, G, H, I, or J", 200, 180, system10, white)
        Draw.Text ("Press any key to return to menu...", 200, 160, system10, white)
        getch (anykey)
        menudraw /* 