search
[last updated: 2024-08-08]
Arduino programming
-----
and use the build-in math function sqrt().
Parameters must be type-declared, and are separated with commas if more than one is passed, eg:
void [functionName] ( int param01, char param02 ) {
...
}
If no parameters are passed to the function, it would be defined like this:
void [functionName] () {
...
}
That is, with nothing between the ( )
----------------------------------------
==================================================================================
A function will execute its command statements until it's done, then will return to its calling function.
If you want to exit the function before it is done, use:
return;
The "void" at the beginning of the function declaration specifies that nothing (ie. no parameter or quantity) is returned from the function to the calling program.
If something IS going to be returned, then the 'void' is replaced with the type of the returned quantity, eg:
int [functionName] ( ) {
int var01 = 5;
return var01;
}
Note the last line of the function will be:
return [parameter/quantity to be returned];
.
.
.
eof