Returns
The return statement allows you to early-return any body expression.
In functions this means that the following code will return "20" instead of "40"
A return statement will only return the nearest block. Meaning that the following will not return it's outer function:
Return statements will return the nearest function block, meaning the following example will cancel the for loop and return the function with the value 20.
Last updated