Runtime evaluation/In an environment: Difference between revisions

→‎{{header|Octave}}: changed into an imitation of python, more or less
(clarify task: mention not using a global variable, avoid the 'provided code is a function' interpretation)
(→‎{{header|Octave}}: changed into an imitation of python, more or less)
Line 97:
=={{header|Octave}}==
 
<lang octave>pfunction =r "x= .*calcit(f, 2";val)
{{incorrect|Octave|Either do not use a global variable, or note that this is impossible.}}
x = [1:3]val;
a r = eval(pf);
endfunction
 
p = "x .* 2";
a = calcit(p, [1:3]);
xb = calcit(p, [4:6]);
 
<lang octave>p = "x .* 2";
x = [1:3];
a = eval(p);
x = [4:6];
b = eval(p);
disp(b-a);</lang>