davedelong / DDMathParser

String → Number
MIT License
854 stars 153 forks source link

Feature request: a branch that works with failing conditions without triggering an error. #159

Open steve-h opened 6 years ago

steve-h commented 6 years ago

When using a VariableResolver with function l_if($notfoundthusnil,,) it errors as the $notfoundthusnil variable does not resolve. Sort of a javascript 'falsy' kind of problem.

What would be nice is a logical function l_notfalsy($notfoundthusnil,,) that will execute the false branch if the VariableResolver returns nil but the user is then unwise to use the $notfoundthusnil variable in the false branch. Need a function that executes the test expression and if it is nil,0,crashes,undefined then it executes the alternate (3rd) expression.