github.com/goplus/gop@v1.2.6/printer/_testdata/10-List-comprehension/list_comprehens.gop (about)

     1  y := [x*x for x <- [1, 3, 5, 7, 11]]
     2  println(y)
     3  
     4  y = [x*x for x <- [1, 3, 5, 7, 11] if x > 3]
     5  println(y)
     6  
     7  z := [i+v for i, v <- [1, 3, 5, 7, 11] if i%2 == 1]
     8  println(z)
     9  
    10  println([k+","+s for k, s <- {"Hello": "xsw", "Hi": "Go+"}])
    11  
    12  arr := [1, 2, 3, 4, 5, 6]
    13  x := [[a, b] for a <- arr if a < b for b <- arr if b > 2]
    14  println("x:", x)