Runtime evaluation/In an environment: Difference between revisions

m
→‎{{header|Octave}}: modified to resemble to other examples
(→‎{{header|Tcl}}: this imitates other examples (right?))
m (→‎{{header|Octave}}: modified to resemble to other examples)
Line 95:
=={{header|Octave}}==
 
<lang octave>function r = calcit(f, valval1, val2)
x = valval1;
ra = eval(f);
x = val2;
b = eval(f);
r = b-a;
endfunction
 
p = "x .* 2";
a = disp(calcit(p, [1:3], [4:6]));</lang>
b = calcit(p, [4:6]);
 
disp(b-a);</lang>
 
Output: