Function
A function is a reusable block of code that performs a specific task. It's like a mini-program within your main program. You give it a name, define what it does, and then you can "call" or use it multiple times in your code without having to write the same instructions repeatedly.
to do something
Creates a function with no output.
Key points:
You can change “do something” to a unique tag for your future reference.
This function has no output.
to do something return
Creates a function with an output.
Key points:
You can change “do something” to a unique tag for your future reference.
This function returns a value as specified.
if return
If a value is true, then return the second value.
Key points:
This block can only be used within a function.
When the condition is true and the value is returned, no other blocks will be executed anymore.
runOpMode
Run the user defined function “runOpMode”. You may have defined a function with a different name. The user defined function name will auto populate in the functions list.