勉強記
前回までの続きです。mattsun-plapla.hatenablog.com mattsun-plapla.hatenablog.com mattsun-plapla.hatenablog.com mattsun-plapla.hatenablog.com mattsun-plapla.hatenablog.com Methods Goにクラスは存在しないため、代わりにメソッドが定義できる。 メ…
前回までの続きです。mattsun-plapla.hatenablog.com mattsun-plapla.hatenablog.com mattsun-plapla.hatenablog.com mattsun-plapla.hatenablog.com Range 配列やスライスなどを単純にfor-loopする場合、ちょっと面倒。 Rangeを使えば簡単に反復処理ができ…
前回までの続きです。 mattsun-plapla.hatenablog.com mattsun-plapla.hatenablog.com mattsun-plapla.hatenablog.com 配列 [n]T 型は、型 T の n 個の変数の配列( array )を表します。 func main() { var a [2]int a[0] = 300 a[1] = 500 fmt.Println(a) //…
こちらの記事の続きです。 mattsun-plapla.hatenablog.com mattsun-plapla.hatenablog.com 今回のMore Types編は長いので分割して書いていきます。 Pointers Struct Anonymous struct メソッド Pointers to Struct Anonymous fields Nested Struct Struct Li…
こちらの続編です。mattsun-plapla.hatenablog.comA Tour of Goはこちら。あそべます。Playaround最高。go-tour-jp.appspot.com 今回はfor, if文などについてです。 forループ if-else switch defer stacking defer forループ for 文は下記の3つのパートで分…
A Tour of Goはこちらから行けます。あそべます。日本語もあります。 tour.golang.org 今回は、Packages, variables, and functionsページで勉強していました。 以下、自分なりのまとめ。 package内のexported nameについて 関数の書き方 Naked Return 変数…
Go言語のメソッド構文とは typesって? structって? Go言語のメソッド構文とは Go言語には、他の言語でいうところのクラスに相当する構文がないらしい。ではどうするかというと、 type TwoValuesType struct { X, Y int } func (v TwoValuesType) TwoValues…