![]() |
![]() |
return instruction |
With a return instruction like e.g.. return a function
is left. Within a function thereby optionally a result can be returned.
The function is terminated thereby.
Example: we define a function for doubling values, which will return
a result with the return instruction.
Function name | double |
Function parameter | x |
Instruction for return | return 2*x |
function verdopple(x):In another place of the program the call of this function with the instruction y
return 2*x
= verdopple(2)leads to the assignment of the result 4 to the variable y.