24ワードのスライスがあり、4行6列でリスト形式で表示したい。Goで実装しようとしています。
package main
import (
"fmt"
)
func main() {
words := []string{"peace", "note", "vapor", "notice", "meat", "shed", "immune", "law", "web", "security", "estate", "chat", "biology", "because", "visit", "inch", "credit", "void", "ability", "police", "crush", "begin", "matrix", "wreck"}
for i, s := range words {
fmt.Println(i, s)
}
}
必要な出力:
1.peace 7.immune
2.note 8.law
3.vapor 9.web
4.notice 10.security
5.meat 11.estate
6.shed 12 chat