Skip to content

Instantly share code, notes, and snippets.

@kjk
Last active June 5, 2020 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjk/e4e690a79190b67879fe73dbca03eabe to your computer and use it in GitHub Desktop.
Save kjk/e4e690a79190b67879fe73dbca03eabe to your computer and use it in GitHub Desktop.
package main
import "fmt"
// :show start
func filterEvenValues(a []int) []int {
var res []int
for _, el := range a {
if el%2 == 0 {
continue
}
res = append(res, el)
}
return res
}
// :show end
func main() {
// :show start
a := []int{1, 2, 3, 4}
res := filterEvenValues(a)
fmt.Printf("%#v\n", res)
// :show end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment