|
Contents | Previous | Next | Subchapters |
| Syntax |
return |
return value | |
| See Also | defining functions , multiple return values |
return statement terminates execution of the
current function
and returns execution
to the routine that called the function.
If value is present,
it is the value corresponding to the function
in the calling routine.
clear
function f(n) begin
if n == 0 then begin
print "cannot divide by", n
return
end
print "1. / n =", 1. / n
end
f(0)
O-Matrix will respond
cannot divide by 0
If you continue by entering
f(1)
O-Matrix will respond
1. / n = 1
clear
function f() begin
return 5 * 6
end
print f
O-Matrix will respond
30
return statement
if the multiple return value
syntax is used to
define the function.