github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/cue/testdata/comprehensions/multi.txtar (about)

     1  -- in.cue --
     2  list: [2, 3]
     3  a: [ 3, for x in list {x}, for x in list {x}]
     4  b: [ 3, if true {3}, for x in list if x > 2 {x}]
     5  
     6  issue574: {
     7  	greet: true
     8  	bye:   true
     9  
    10  	message1: [
    11  		if greet {"hello"},
    12  		"how are you doing?",
    13  		"bye",
    14  	]
    15  
    16  	message2: [
    17  		if !greet {"hello"},
    18  		"how are you doing?",
    19  		if bye {
    20  			"bye"
    21  		},
    22  	]
    23  }
    24  -- out/eval --
    25  (struct){
    26    list: (#list){
    27      0: (int){ 2 }
    28      1: (int){ 3 }
    29    }
    30    a: (#list){
    31      0: (int){ 3 }
    32      1: (int){ 2 }
    33      2: (int){ 3 }
    34      3: (int){ 2 }
    35      4: (int){ 3 }
    36    }
    37    b: (#list){
    38      0: (int){ 3 }
    39      1: (int){ 3 }
    40      2: (int){ 3 }
    41    }
    42    issue574: (struct){
    43      greet: (bool){ true }
    44      bye: (bool){ true }
    45      message1: (#list){
    46        0: (string){ "hello" }
    47        1: (string){ "how are you doing?" }
    48        2: (string){ "bye" }
    49      }
    50      message2: (#list){
    51        0: (string){ "how are you doing?" }
    52        1: (string){ "bye" }
    53      }
    54    }
    55  }
    56  -- out/compile --
    57  --- in.cue
    58  {
    59    list: [
    60      2,
    61      3,
    62    ]
    63    a: [
    64      3,
    65      for _, x in 〈1;list〉 {
    66        〈1;x〉
    67      },
    68      for _, x in 〈1;list〉 {
    69        〈1;x〉
    70      },
    71    ]
    72    b: [
    73      3,
    74      if true {
    75        3
    76      },
    77      for _, x in 〈1;list〉 if (〈0;x〉 > 2) {
    78        〈1;x〉
    79      },
    80    ]
    81    issue574: {
    82      greet: true
    83      bye: true
    84      message1: [
    85        if 〈1;greet〉 {
    86          "hello"
    87        },
    88        "how are you doing?",
    89        "bye",
    90      ]
    91      message2: [
    92        if !〈1;greet〉 {
    93          "hello"
    94        },
    95        "how are you doing?",
    96        if 〈1;bye〉 {
    97          "bye"
    98        },
    99      ]
   100    }
   101  }