LoginSignup
0
0

More than 3 years have passed since last update.

配列

Last updated at Posted at 2019-06-05

配列の基本

func main() {
    var a [2]int
    a[0] = 100
    a[1] = 200
    fmt.Println(a)

    /*
    var b [2]int = [2]int{100, 200}
    b = append(b, 300) //appendで配列をリサイズできない
    fmt.Println(b)
    */

    //スライス
    var c []int = []int{100, 200}
    c = append(c, 300)
    fmt.Println(c)
}

配列はリサイズできない。スライスはできる。

【参考】
現役シリコンバレーエンジニアが教えるGo入門(https://www.udemy.com/share/100BhMB0obeFpbTX4=/)

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