Skip to content
Discussion options

You must be logged in to vote

Hello.

if in rego is used for defining rules, not as an expression in rule bodies. So you could do

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 if:

package test

deny { valid != true } # a very short rule

valid { # another rule definition
	value := input.value
	print(value)
	value >= 1
	value <= 10
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by sduff
Comment options

You must be logged in to vote
1 reply
@srenatus
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants