Universal Robots Forum

Switch/case instructions?

Are switch/case instructions available from within URScript?
If so, are they documented somewhere?

if you look at the script code which is generated by polyscope for the case statement, you can see that it is translated into if, elif and else:

$ 2 "var_1≔5"
global var_1=5
$ 3 "Switch var_1"
switch_1 = var_1
if (1 == switch_1):
  $ 5 "Popup"
  popup("1", "Message", False, False, blocking=True)
elif (2 == switch_1):
  $ 7 "Popup"
  popup("2", "Message", False, False, blocking=True)
else:
  $ 9 "Popup"
  popup("default", "Message", False, False, blocking=True)
end

answer: no, there is no switch-case in scriptcode, implement it as polyscope does