miroiu/string-math

Will you support Boolean expression?

Closed this issue · 4 comments

This is a great project!
Will you support Boolean expression?

miroiu commented

Hi! Thank you.

The result of an expression is always a double. Can you give me an example of how you imagined this?

looks like
bool result = "true || false && !true".EvlaBool();,
or use dynamic var

var result = "1 && 0 || !0 && 3 > 2".Evla();
if(result is bool){
// ....
}
miroiu commented

I created a PR with sample unit tests that demonstrates how you can do boolean math with a custom math context and a few extension methods. Please let me know if that suits your needs. (see #6)

Thank you!👍
It works fine!