0
0

More than 1 year has passed since last update.

Go-lang の文字列を宣言&代入する

Last updated at Posted at 2021-10-17

Go言語の勉強メモ

:= ってなんや?ってやつ。

var がいらない && 暗黙の型定義するときに使うらしい

下はすべて同じ意味

    var msg1 string = "Hello World"
    var msg2 = "Hello World"
    msg3 := "Hello World"

    var msg4 := "Hello World"    // syntax error
    msg5 string = "Hello World"   // syntax error
    msg6 = "Hello World"      // syntax error

refers

https://qiita.com/HiromuMasuda0228/items/65b9a593275f769f6b69
https://qiita.com/tfrcm/items/e2a3d7ce7ab8868e37f7

あと文字列内で変数展開ができないという衝撃
https://qiita.com/KEINOS/items/baef1be88f15515026ec

なんかちょっと、VBAを思い出す感じだった

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