This is an old revision of the document!
Functions are the set of statements that are executed always when the function is called. Two functions that were mentioned before are already known - setup() and loop(). The programmer is usually trying to make several functions that contain all the statements and then to call them in the setup() or loop() functions.
The structure of the function is following:
type functionName(arguments) //a return type, name and arguments of the function { //the body of a function - statements to execute }
For the example, a function that periodically turns on and off the LED is created:
void exampleFunction() { digitalWrite(13, HIGH); //the LED is ON delay(1000); digitalWrite(13, LOW); //the LED is OFF delay(1000); }
In the example code can be seen that the return type of an exampleFunction function is void that means the function does not have the return type. This function also does not have any arguments, because the brackets are empty.