LoginSignup
1
0

More than 5 years have passed since last update.

Short variable declarationsの挙動メモ

Last updated at Posted at 2018-07-11

再定義がNGなパターン

height := 10
height := 20
height, weight := 10, 5
height, weight := 20, 10
height := 10
height, weight := "20", 10

OKなパターン

height := 10
height, weight := 20, 10
println(height, weight)
height1, weight := 10, 5
height2, weight := 20, 10
println(height1, height2, weight)

どうやら未定義の変数が存在する かつ 再定義される変数は型が同じじゃないとだめみたい

コレも読むといい https://t.co/JcIH6RmXwF

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