()
| 287 | } |
| 288 | |
| 289 | func ExampleAsBool_error() { |
| 290 | env := map[string]any{ |
| 291 | "foo": 0, |
| 292 | } |
| 293 | |
| 294 | _, err := expr.Compile("foo + 42", expr.Env(env), expr.AsBool()) |
| 295 | |
| 296 | fmt.Printf("%v", err) |
| 297 | |
| 298 | // Output: expected bool, but got int |
| 299 | } |
| 300 | |
| 301 | func ExampleAsInt() { |
| 302 | program, err := expr.Compile("42", expr.AsInt()) |