Thread: about Eval
View Single Post
# 1 23-05-2014 , 10:22 AM
Registered User
Join Date: May 2014
Location: Seoul, Korea
Posts: 3

about Eval

Anyone here familiar with 'Complete Maya Programming' book by David Gould? Well I'm studying with that book now and I'm kinda stuck with sth I don't understand. I was hoping you guys could help me understand.

I'm and the Eval Command part where the sample code reads as follows;


global proc calc (string $statement)
{
float $res = eval("float + $_dummy = " + $statement);
print ("\n" +$statement +"=" +$res);
}

calc("1+2");
calc("10*2/5");


results shows '1+2=3' and '10 *2/5 = 4'

what I don't get here is how these results show up.
I get the basic fact the eval command allows you to execute things in string form.
what I really don't get is this part ;

eval("float + $_dummy = " + $statement);
print ("\n" +$statement +"=" +$res);


I have no idea how this works to show both the equation and its result.
can any of you help me?