You are on page 1of 2

String is a rule (grammar in English)

Void () – no value (empty values)


Variables can be int, char, bool, float etc. but variables can contain one value at a time.
E.g., int a;
char b;
float c;
etc.
for example, a = 10/3; the result will be 3. because of a is integer (not float).

If you want to get the result in integer you can simply use float instead of int. but in this case we
have to put 10.0 and 3.0 instead of 10 & 3.

Shortcuts
a++ ↔ a = a+1;
a-- ↔ a=a-1;
a+=2 ↔ a = a+2;
a-=3 ↔ a = a – 3;
a*=4 ↔ a = a*4;
a/=2 ↔ 1 = a/2;
a%=2 ↔ a=a%2;

a = 5, - is an assignment (assign 5 to the value of a)


a==5, - is if a is equal to 5

Conditional statements
Int a = 3; Int a = 11;
Void setup () Int b = 2;
{
Serial.begin (9600); Void setup ()
If (a>3) {
{ Serial.begin(9600);
serial.println(“It is less than 5”); If ((a != 3)|| (b>3)) {
} Serial.println(“True”);
else if (a == 5) }
{serial.println(“it is equal to 5”); }
else Void loop () {
{ serial.println(“it is greater than 5”); }
}
Void loop ()
{
}
While loop

int a = 0;
serial.begin (9600);
while (a>3)
serial.println (“hello world”);
}
}

This will print Hello world conteneously. b/c


a is always

You might also like