davedelong / DDMathParser

String → Number
MIT License
854 stars 153 forks source link

nil/null support in if statements #149

Closed HarshSharma12 closed 6 years ago

HarshSharma12 commented 6 years ago

We are trying to parse the following function :- attr1 - if(attr2==nil, 0,attr2)

Is the syntax correct because the value returned is long max.

Using latest version of DDMathParser (Swift 4.0).

davedelong commented 6 years ago

Yeah, nil isn’t really a thing in DDMathParser, because numeric values always exist. In the case of variables, an error will be thrown during evaluation if the variable value is missing. Therefore, checking for nil isn’t necessary.