An if function that only calculates its parameters as
needed
e.g. if(3<0:1/0:9) does not return a value of 9 - it
returns a 'Division By 0' error even though it is not
necessary to calculate 1/0 to return the correct answer
of 9
this is not possible directly since easycalc will calculate
all parameters before it looks up the function. However, you
can use function strings and evaluate them wirh an eval
function.
try these function definitions:
temp()="x";
eval()="temp()=x;x()"
then you can do
eval(if(3<0:"1/0":"9"))
It would be possible to create a built-in eval function (or
an if function that can work with function strings directly)
for things like this, is this needed?
Michael
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=729958
this is not possible directly since easycalc will calculate
all parameters before it looks up the function. However, you
can use function strings and evaluate them wirh an eval
function.
try these function definitions:
temp()="x";
eval()="temp()=x;x()"
then you can do
eval(if(3<0:"1/0":"9"))
It would be possible to create a built-in eval function (or
an if function that can work with function strings directly)
for things like this, is this needed?
Michael
Logged In: YES
user_id=147684
Originator: NO
Implemented in 1.25