Last active
January 23, 2019 23:31
-
-
Save chardos/047e05ebe90464ad4fabf7d25cc57822 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
// make a slice, without starting length off 0 | |
s := make([]string, 0) | |
// above is same as | |
// s := []string{} | |
s = append(s, "hello") | |
fmt.Println(len(s)) // prints length of s | |
// initiate it with some values inside | |
s2 := []string{"a","b","c"} | |
// iterate it | |
for k, v := range s3 { | |
fmt.Println(k, v) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment