Skip to content

Option to disable short-circuiting #831

Description

@lvliangxiong
package main
import (
"fmt""github.com/antonmedv/expr"
)
funcmain() {
env:=map[string]any{
"a": func() bool { fmt.Println("a executed"); returntrue },
"b": func() bool { fmt.Println("b executed"); returnfalse },
}
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions