<< Click to Display Table of Contents >> Navigation: MODELS > Examples > Models Functions |
This example illustrates statement functions in MODELS
MODEL fundef
CONST z9 {val: 9}
VAR k
FUNCTION fun1(x1, x2) := x1 +x2
FUNCTION fun2(x1, x2 {dflt: 0}, x3) :=x1 +x2 +x3 -t
EXEC
write("****** In model 'fundef' at t=", t)
k:=1
k:=fun1(k+t, 2*z9) write(19+t, " : ", k)
k:=fun2(-2.4, 5, 3*t) write(2.6+2*t, " : ", k)
k:=fun2(-1, dflt, t) write("-1 : ", k)
ENDEXEC
ENDMODEL