github.com/goplus/gop@v1.2.6/printer/_testdata/12-Select-comprehension2/findscore.gop (about) 1 type student struct { 2 name string 3 score int 4 } 5 6 func findScore(a []student, name string) (score int, ok bool) { 7 return {x.score for x <- a if x.name == name} 8 } 9 10 a := [student{"ken", 95}, student{"john", 90}, student{"tom", 58}] 11 println(findScore(a, "tom"))