Runtime evaluation/In an environment: Difference between revisions

Content added Content deleted
(→‎TI-89 BASIC: new example)
Line 286: Line 286:
}
}
eval_with_x {expr {2**$x}} 3 5 ;# ==> 24</lang>
eval_with_x {expr {2**$x}} 3 5 ;# ==> 24</lang>

=={{header|TI-89 BASIC}}==

evalx(prog, a, b)
Func
Local x,eresult1,eresult2
a→x
expr(prog)→eresult1
b→x
expr(prog)→eresult2
Return eresult2-eresult1
EndFunc

■ evalx("ℯ^x", 0., 1)
1.71828

There are no facilities for control over the environment; expr() evaluates in the same environment as the caller, including local variables. [Someone please verify this statement.] [[Category:TI-89 examples needing attention]]

{{omit from|Java}}
{{omit from|Java}}