Files
master_go_programming/Section11/89-1.go
2023-11-15 15:18:17 +01:00

22 lines
372 B
Go

/*
Coding Exercise #1
Using a composite literal declare and initialize
a slice of type string with 3 elements.
Iterate over the slice and print each element in
the slice and its index.
*/
package main
import "fmt"
func main() {
countries := []string{"Romania", "Brazil", "Germany"}
for i, v := range countries {
fmt.Printf("Index: %d, Element: %q\n", i, v)
}
}