The eval
function evaluates a string. The general syntax
for its use is
eval(s)
where s
is the string to evaluate.
Here are some examples of eval
being used.
--> eval('a = 32') a = <int32> - size: [1 1] 32 ans = <double> - size: [] []
The primary use of the eval
statement is to enable construction
of expressions at run time.
--> s = ['b = a' ' + 2'] s = <string> - size: [1 9] b = a + 2 --> eval(s) b = <int32> - size: [1 1] 34 ans = <double> - size: [] []