/* 19/07/2021 ifelsev2 Purpose, to to learn to use the "if" function */ //choosing a name int q; //start with a lower case letter, if a second word no spaces butu start with a capital letter void setup() { // Serial.begin(9600) starts serial communication. 9600bps bits per second = 1200 characters per second Serial.begin(9600); //Send script name Serial.println("ifelsev2..."); //this will print a blank line Serial.println(" "); } void loop() { // print in the loop Serial.print("Val q: "); Serial.println(q); //equals to IMPORTANT NOTE q == 4 NOT the same as q = 4; if(q == 4){ Serial.println("q == 4"); } //q NOT equal to 4 if(q != 4){ Serial.println("q != 4"); } //q smaller than 4 if(q < 4){ Serial.println("q < 4 smaller than"); } //q smaller or equal to 4 if(q <= 4){ Serial.println("q <= 4 smaller or equal"); } //q greater or equal to 4 if(q >= 4){ Serial.println("q >= 4 greater or equal"); } // ">" means greater than if(q > 10){//change the value from 10 to 20 q = 0; } q++; delay(100); }