0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Go】関数の書き方とか呼び出し方とか

Posted at

内容

Go言語における関数の色々を忘れないように書いておきます。

関数の定義の仕方

func 関数名() {
// まとめたい処理を書く
}

関数の呼び出し方

関数名()

関数に値を渡す

関数名(値)

引数を受け取って使う

funk main() {
// catを引数として変数animalに渡している
  ask("cat")
}

funk ask(animal string) {
  fmt.Printf("%s/n", animal)
}
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?