Expected behavior of comprehensions #323
-
I was trying to understand how the comprehensions work. I tested the following example in the Rego Playground:
The results of
The likely explanation is that the
But I can't find references that explain whether this is correct. Is this an expected behavior? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi there! Your analysis is correct. There are probably better explanations available in the docs, but this one comes to mind.
The same goes for comprehensions — there are two "bindings" in your comprehension where the expression is true, resulting in two items stored in the resulting array. |
Beta Was this translation helpful? Give feedback.
Hi there!
Your analysis is correct. There are probably better explanations available in the docs, but this one comes to mind.
The same goes for comprehensions — there are two "bindings" in your comprehension where the expression is true, resulting in two items stored in the resulting array.