return
Description
Terminate a function and return a value from a function to the calling function, if desired.
Syntax
Parameter Values
- value: Allowed data types: any variable or constant type.
Example Code
A function to compare a sensor input to a threshold
The return keyword is handy to test a section of code without having to "comment out" large sections of possibly buggy code.
Testing Example
The result on Serial Monitor:
As we can see, the text after return is not printed.
See Also
- Language : break
- Language : continue
- Language : do...while
- Language : else
- Language : for
- Language : goto
- Language : if
- Language : switch...case
- Language : while
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |