Closed jpluscplusm closed 2 weeks ago
From Slack: https://cuelang.slack.com/archives/CLT4FD7KP/p1712225294101449
We want to include multiple items in a list conditionally.
This works if multiple if blocks are used:
if
x: true y: [ 1, 2, if x {3}, if x {4}, ]
... but doesn't work if we try to emit multiple values from the same if clause:
// this CUE fails to evaluate x: true y: [ 1, 2, if x { 3, 4, } ]
@mvdan pointed out an approach which permits just a single if block to be used:
x: true y: [ 1, 2, if x for e in [ 3, 4, ] {e}, ]
From Slack: https://cuelang.slack.com/archives/CLT4FD7KP/p1712225294101449
We want to include multiple items in a list conditionally.
This works if multiple
if
blocks are used:... but doesn't work if we try to emit multiple values from the same
if
clause:@mvdan pointed out an approach which permits just a single
if
block to be used: