You have to create a switch function with the cases you want and the identifiers (case 1, case 23, case 41...). And then you have to call that cases, if you don't have case 2, you can't execute it. Do you have a correct code inside the case?
robot progvar 2 =0switch var 2 = 0case 1do somethingcase 2 do somethingend of progthis is just a simple program created with a switch command.. in this case only case 1 is excuted and case 2 is not.. but I don't know if the program is correct, it is my first tym using switch command..
Unless var2 = 2 then that case will not execute, in your example case 1 would also not execute since var2 == 0. If you had a default case in your example when var2 equals anything other than 1 or 2 the default case would execute. Hope me this makes sense. Let me know if you need anymore help.
Try with something like this (pseudocode):Robot programoption = 'Choose option' (Source: operator)Switch option Case 1 do something Case 2 do something Default Case do something elseEnd of program
Depending on how you want your program to function there's a couple ways to do it. In the example @student gave, the operator will be asked for a number and then based on that number it will run everything in that specific case. If you wanted the robot to go from case to case to all the way through the switch you would want to do something along these lines:Robot programoption = 1Switch option Case 1 do something option=2 Case 2 do something option=3 Case 3 do something option=4I use this approach to control the flow of my programs easily. If you were in case one and based off of a certain condition that was met during that case, you could use an if-statement to make the decision on which case to run next. Lets say case 1 is trying to pick a part from a specific location and based on if the robot found the part or not determines what case you want the robot to go next. if part_found= True option=2if part_found= False option=3I hope that makes sense and helps out.
i have a problem in executing it in another case.. only Case 1 is executing other case is not..