UBTECH Alpha Servos UBT-12HC icon UBTECH Alpha Servos UBT-12HC — Control UBTECH Alpha UBT-12HC smart servos via ARC using EZ-B v4/IoTiny UART, assign virtual ports, set baud, custom bits and position mapping. Try it →
Asked
Resolved Resolved by DJ Sures!

Switch / Case Statement

I am neck deep  in programming my "Simone" robot. I know that I can use multiple or nested if/elseif/then statements, but what would really make my life easier would be a "switch / case statement."

switch(expression) {

   case constant-expression  :
      statement(s);
      break; 
   
   case constant-expression  :
      statement(s);
      break; 

    default : 

By the way, what programming language was EZ Script based on?


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#1   — Edited

Both JavaScript and python support that. This is a question not a request. It’s been changed

here’s a link to learn how to use a switch statement with JavaScript: https://www.w3schools.com/js/js_switch.asp

#2  

Just a little additional info, EZ Script is essentially based on VB Script, but as DJ pointed out, ARC also supports more advanced languages like Javascript and Python as well as Blocky, which is a drag and drop based on another language whose name currently escapes me. 

Alan

#3  

DJ,

So you are saying that I should move to Python. OK. I'll give it a try. Thanks!

--Thomas

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#4  

Python or JavaScript. I prefer JavaScript because python doesn’t seem visually esthetically pleasing to me. Either work and either are hundreds of times faster than ezscript