/* 21/07/2021 switchv2 Purpose, switch statement comparing multiple values in a single case */ //An int is an integer, a Number, any value between -32,768 and 32,767 int q; int w; void setup() { // Serial.begin(9600) starts serial communication. 9600bps bits per second = 1200 characters per second Serial.begin(9600); //Send script name Serial.println("switchv2..."); //this will print a blank line Serial.println(" "); } void loop() { //q starts with a value of Zero, the loop continues while q smaller than 20 for (q = 0; q < 20; q++) { Serial.print("q: "); Serial.println(q); switch(q){ case 1: Serial.println("q is equal to 1"); break; case 2: Serial.println("q == 2"); break; case 5 ... 10: Serial.println("value from 5 to 10"); break; default: Serial.println("q is not equal to 1 or 2"); break; } } //delay outside the for loop delay(100); }