void setup vs setup

i keep seeing void setup and void loop in codes but what does the void bit actually mean?

thanks :slight_smile:

Every function has a return type. It returns some value. Except in the cases where the function has nothing to return. In these cases, like setup() and loop(), the return type is declared void, to indicate to the compiler that there is no value to return.

The return type is important, because the value is pushed onto a stack, and popped off the stack. The stack is byte sized, so the number of bytes to pop off the stack is determined by the return type.

A byte function will cause 1 byte to be popped. An int function will cause 2 bytes to be popped. A void function will cause 0 bytes to be popped.

The return type is important, too, when assigning the return value to a variable, or passing the return value to another function. A void return type can not be stored in a variable, or passed to another function.