Home› Troubleshooting
Discussion
Back to discussions page
JoAN
Posts: 2 Recruit
using Switch statment in UR 5 pendant programming |
1.7K views
|
Answered | |
/ Most recent by matthewd92 |
3 comments |

Hi
i try to find the syntax for make the program to select the proper case in a switch statment, i have not found any examples of how to define the statement
i try to find the syntax for make the program to select the proper case in a switch statment, i have not found any examples of how to define the statement
Best Answer
-
matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,252 Handy
You have to use a variable which is an integer. You will switch on this variable. Then each of your cases will correspond to the integer value of the variable. You cannot use strings. The basic structure looks something like this.
global counter = 0
Loop until counter > 2
Switch counter
Case 0
Do something here
case 1
Do something else here
case 2
And something else here
case default
Default behavior
End switch
counter=counter +1
end loop
yes in basics it works but the detailed syntax is not like this when program in the pendant, but never the less I managed with this information:)