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】インターフェース(タイプアサーション・switch type文)

Last updated at Posted at 2020-03-23

どんな型が入るかわからない・なんでもOKの場合、
インターフェースを引数にして受け取る

[受け取ったときの処理]

・関数内でアサーションしてタイプを確定させる 例:a.(int)
・switch type文で型を判定するのも可能

・参考リンク:
https://blog.y-yuki.net/entry/2017/05/08/000000

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?