Unexpected if keyword error, for basic complete rule example #402
-
G'day, I have been unable to get a simple complete rule working on the Rego Playground,
It gives the error that
Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hello.
package test
import future.keywords.if
deny if valid != true # a very short rule
valid if { # another rule definition
value := input.value
print(value)
value >= 1
value <= 10
} it's equivalent to this, without package test
deny { valid != true } # a very short rule
valid { # another rule definition
value := input.value
print(value)
value >= 1
value <= 10
} |
Beta Was this translation helpful? Give feedback.
-
Thank you, I ended up going with this process. Any issues with this approach?
|
Beta Was this translation helpful? Give feedback.
Hello.
if
in rego is used for defining rules, not as an expression in rule bodies. So you could doit's equivalent to this, without
if
: