Skip to content

Instantly share code, notes, and snippets.

@jjuliano
Created June 2, 2019 22:05
Show Gist options
  • Save jjuliano/80c97fc9627b4e4f48130f6640a9096c to your computer and use it in GitHub Desktop.
Save jjuliano/80c97fc9627b4e4f48130f6640a9096c to your computer and use it in GitHub Desktop.
var collect [4]int
integers := [4]int{1, 2, 3, 4}
for i := 0; i < len(integers); i++ {
collect[i] = integers[i] * integers[i]
if i == len(integers) - 1 {
fmt.Println(collect)
}
}
// [1 4 9 16]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment