Skip to content

support nil value to compare #755

Open
@5idu

Description

@5idu

please run the example code below:

package main

import (
	"fmt"

	"github.com/expr-lang/expr"
)

func main() {
	env := map[string]any{}

	tests := []struct{ code string }{
		{`key == "str"`}, // ok
		{`key >= "str"`}, // invalid operation: <nil> >= string
		{`key > "str"`},  // invalid operation: <nil> > string
		{`key <= "str"`}, // invalid operation: <nil> <= string
		{`key < "str"`},  // invalid operation: <nil> < string
	}

	for _, tt := range tests {
		program, _ := expr.Compile(tt.code)
		output, err := expr.Run(program, env)
		fmt.Println(output, err)
	}
}

can Expr support >>=<<= like == operator? tks~

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions