Runtime evaluation/In an environment: Difference between revisions

→‎{{header|Metafont}}: if the problem was the "global" variable... fixed (as tcl, similar to php)
m (→‎{{header|PHP}}: php var inside functions, if not declared global, are local; should the code be "splitted" as done for tcl? waiting feedback)
(→‎{{header|Metafont}}: if the problem was the "global" variable... fixed (as tcl, similar to php))
Line 84:
=={{header|Metafont}}==
 
<lang metafont>vardef evalit(expr s, v) =
{{incorrect|Metafont|Either do not use a global variable, or note that this is impossible.}}
asave x; x := v; scantokens p;s
enddef;
 
a := evalit("2x+1", 5);
<lang metafont>string p;
pb := evalit("2x + 1", 2);
show (a-b);
x := 5;
end</lang>
a := scantokens p;
message decimal a; % 11
x := 2;
b := scantokens p;
message decimal b; % 5</lang>
 
=={{header|Octave}}==