0
0

Golangでコンソール表示させる方法

Posted at

文字列を表示させたい場合

main.go
package main

import "fmt"

func main {
    fmt.Println("Hello World!")
}

注意点

Goではダブルクォート""で囲わないと文字列と判定されません。

変数を表示させたい場合

main.go
package main

import "fmt"

func main {
    num := 4
    fmt.Println("num")
}

2つ以上の変数を表示させたい場合

main.go
package main

import "fmt"

func main {
    num := 4
    fmt.Println("num=", num)
}

結果

num=4

注意点

2つ以上の変数をつなげたい場合は , で変数をつなげます。

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