LoginSignup
1
0

More than 1 year has passed since last update.

Go 言語で スライスを合体させてトランプの組み合わせを作る ( #go join multiple string slice n times )

Last updated at Posted at 2020-03-16
// https://golang.org/pkg/math/rand/

package main

import (
	"fmt"
)

func main() {
	cards := []string{"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"}
	cards4 := []string{}

	for i := 0; i < 4; i++ {
		cards4 = append(cards4, cards...)
	}

	fmt.Println(len(cards4)) // 52
	fmt.Println(cards4)      // [2 3 4 5 6 7 8 9 10 J Q K A 2 3 4 5 6 7 8 9 10 J Q K A 2 3 4 5 6 7 8 9 10 J Q K A 2 3 4 5 6 7 8 9 10 J Q K A]
}

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0