Skip to content

Conditionals in lists #713

Answered by cueckoo
cueckoo asked this question in Q&A
Jul 3, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Original reply by @myitcv in cuelang/cue#713 (comment)

I'll leave @mpvl to comment on whether anything like this would ever make sense.

But for now you can:

package x

a: true

l: [
	for _, v in ["foo", "bar"] if a {
		v
	},
	"foobar",
]

Replies: 1 comment 1 reply

Comment options

cueckoo
Jul 3, 2021
Collaborator Author

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

cueckoo Jul 3, 2021
Collaborator Author

Answer selected by cueckoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant