LoginSignup
1
0

More than 3 years have passed since last update.

競プロで使うための GO 入門 ~Hello World~

Last updated at Posted at 2020-07-18

Index

Hello World

package main

import "fmt"

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

パッケージ

関数を使用するためには、パッケージをインポートする必要がある。
"fmt"は、標準入出力の関数を含む。

import "fmt"

または、

import(
    "fmt"
)

ブレースの位置

Goはブレースの位置が決まっているため、以下の記述ではエラーになる。

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

// エラー出力例
// missing function body
// syntax error: unexpected semicolon or newline before {
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