github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/doc/tutorial/basics/6_expressions/40_listcomp.txt (about) 1 cue eval listcomp.cue 2 cmp stdout expect-stdout-cue 3 4 -- frontmatter.toml -- 5 title = "List Comprehensions" 6 description = "" 7 8 -- text.md -- 9 Lists can be created with list comprehensions. 10 11 The example shows the use of `for` loops and `if` guards. 12 13 -- listcomp.cue -- 14 [ for x in #items if x rem 2 == 0 { x*x } ] 15 16 #items: [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] 17 18 -- expect-stdout-cue -- 19 [4, 16, 36, 64]