Syntactic sugar for multiple in tests on a list

24 views
Skip to first unread message

Prathik Rajendran M

unread,
Mar 14, 2023, 10:21:43 PM3/14/23
to CEL Go Discussion Forum
Hi,

Is there any better way to write the following expression

"value-a" in list && "value-b" in list

Perhaps something like the following (but I know that doesn't work)

 ["value-a", "value-b"] in list

I can always write a custom global function, but wanted to know if there is something like this already.

Thanks!

Dan Kortschak

unread,
Mar 15, 2023, 2:13:53 AM3/15/23
to cel-go-...@googlegroups.com
You can use the all macro.

["value-a", "value-b"].all(e, e in list)


Reply all
Reply to author
Forward
0 new messages