LoginSignup
0
0

More than 1 year has passed since last update.

Go言語でSliceを要素に持つStructを定義する例 ( #Go )

Last updated at Posted at 2020-03-16
package main

import "fmt"

type Card struct {
	Names []string
}

func main() {
	card := Card{[]string{"Ace", "Jack", "King"}}

	fmt.Println(card.Names[0]) // Ace
	fmt.Println(card.Names[1]) // Jack
	fmt.Println(card.Names[2]) // King
}

Original by Github issue

チャットメンバー募集

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

Twitter

0
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
0
0