Menu

#86 if function

closed
nobody
None
5
2007-09-27
2004-03-03
donkey
No

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

Discussion

  • Michael Schierl

    Michael Schierl - 2006-05-19

    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

     
  • Ton van Overbeek

    • status: open --> closed
     
  • Ton van Overbeek

    Logged In: YES
    user_id=147684
    Originator: NO

    Implemented in 1.25

     

Log in to post a comment.

MongoDB Logo MongoDB