However, you can totally declare it as whatever you want!
The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, etc. The setup function will only run once, after each power up or reset of the Arduino board. For example,
These are logical arithmetic statements you can implement into your program in order to control different functions or loops.
For instance, you can use these conditional statements to turn your Jewelbot into a calculator! Let's say you have variables called x and y.
You can set these variables to equal your math homework problems!
Now you can use the conditional statements to test which variable is bigger! If...then... This is a conditional statement that performs an activity only if something specific happens.
This block of code programs states that if the variable x is greater than y then your Jewelbot will light up purple on LED pin 1. The second conditional states that if the variable y is greater than x then your Jewelbot will light up red on LED pin 2.
This is a conditional statement that performs an activity if something specific happens, but in any situation where that specific thing doesn't happen, then it will do something else.
This block of code programs your Jewelbot to turn the LED on pin 1 to light up purple if variable x is greater than y. Otherwise, your Jewelbot will turn the LED on pin 2 to light up red for all other conditions, without having to set up a conditional for if y is greater than x.
The loop() function does precisely what its name suggests, and loops consecutively whatever you coded your program to do over and over again!
This is different from the if-then or if-else conditionals, as this will set a conditional that causes your program to loop itself a specific amount of times.
The for-loop has a set of 3 parameters. A declaration of an int, a condition for running the loop, and an increment. For instance, a for-loop could start as for(int z = 0, z < 10, z++). This means that there a variable of z with the value of 0, that will increase by 1 for as long as it is less than 10. However, the value of z will only increment when the for-loop completes one cycle of the steps you programmed within it.