Arduino Programming Language: Return

Name

return

Description

The return statement is used to terminate the execution of a function and return a value from the calling function. All that is after return, will never be executed.

Syntax

return [value];

Parameters

  • value: any variable or constant type.

Usage

Application.

Examples

int checkSensor(){
if (analogRead(0) > 400) {
return 1; //return value 1 to the calling function
else{
return 0; //return value 0 to the calling function
}
}


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc