Skip to content

Instantly share code, notes, and snippets.

@xvbnm48
Created December 18, 2022 02:37
Show Gist options
  • Save xvbnm48/b1ffce2219af8505942034b918f3bfd8 to your computer and use it in GitHub Desktop.
Save xvbnm48/b1ffce2219af8505942034b918f3bfd8 to your computer and use it in GitHub Desktop.
slice for golang
package main
import "fmt"
func main() {
// Membuat slice dengan make
a := make([]int, 5)
fmt.Println(a) // Output: [0 0 0 0 0]
// Membuat slice dengan sintaks []T
b := []int{1, 2, 3, 4, 5}
fmt.Println(b) // Output: [1 2 3 4 5]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment