Computer Science Canada Loops |
Author: | SucreTeen123 [ Sun Jun 03, 2012 9:48 am ] |
Post subject: | Loops |
Okay, so my problem is I have to loops because I have different pages on my forward procedure. What I am trying to do is when I hit the 1 I go to inventory and go back to the menu by hitting any random button. When I hit 2 i go to Description of my items, but I have 12 items and I need to be able to go to their pages. But when I enter 'a' it brings me back to the menu. I tried putting them all in one loop but it won't work. I need to have the description choices a - l on the Description page so I can go to the description of each item. Please help. This problem is really confusing for me. loop var option : string (1) menu getch (option) case option of label "1" : Inventory label "2" : Description end case end loop loop var option2 : string (1) Description getch (option2) case option2 of label "a" : Rihanna label "b" : SHINee label "c" : BigBang label "d" : MichaelJackson label "e" : KellyClarkson label "f" : EP label "g" : KatyPerry label "h" : OneRepublic label "i" : MBLAQ label "j" : Adele label "k" : Infinite label "l" : Hedley end case end loop |
Author: | Aange10 [ Sun Jun 03, 2012 1:05 pm ] |
Post subject: | RE:Loops |
You only need one loop. Do you know how procedures work? |
Author: | SucreTeen123 [ Sun Jun 03, 2012 1:29 pm ] |
Post subject: | Re: Loops |
I know that but I'm using a forward procedure and my teacher says that it is possible and I just have to figure it out. I have seperated my forward procedure into 4 different body procedures. The 2nd body procedure called Description needs to be seperated into 12 different body procedures. I need two loops so I can go from the menu to the description and from description to each of the different artists of the cds. It's either using loops or creating some kin dof "+" button to extend a list and a "-" button to shorten the list so I can just have one loop where I can access all of my descriptions. But I don't know if the second one is even possible, so I have to use the first one. |
Author: | Aange10 [ Sun Jun 03, 2012 2:47 pm ] | ||
Post subject: | RE:Loops | ||
You only need one loop. Why don't you make a procedure to draw each screen. Say 'drawMenu', and it will draw the menu. Then you could take input to the user, and do something like
|