package main
import (
"fmt"
"github.com/antonmedv/expr"
)
func main() {
env := map[string]any{
"a": func() bool { fmt.Println("a executed"); return true },
"b": func() bool { fmt.Println("b executed"); return false },
}
program, _ := expr.Compile(`a() || b()`, expr.Env(env))
_, _ = expr.Run(program, env)
// Output:
// a executed
}
Output of above code will be a executed.
But I'm wondering if there's an option which I can pass to the expr, or something else I'can do to disable the shortcircuit effect.
After disabling shortcircuit, output will be a executed and b executed.
Output of above code will be
a executed.But I'm wondering if there's an option which I can pass to the expr, or something else I'can do to disable the shortcircuit effect.
After disabling shortcircuit, output will be
a executedandb executed.