ttwo(x)
,
which multiplies its argument by >> function y=ttwo(x) y=2*x; end >> ttwo(3.123) ans = 6.246Following the keyword
function
is the prototype with a return
variable y
. This replaces the construct return y
of other
programming languages.
If functions are to be reused later, they should be written to a textfile
and saved somewhere in Jasymcas searchpath. The filename must be the
function name extended by ``.m'', in the present example ttwo.m
.
In subsequent sessions the function ttwo
can be used without
separately loading the file. Several installed functions of Jasymca
are provided using this mechanism.