Logo

Programming-Idioms

History of Idiom 94 > diff from v27 to v28

Edit summary for version 28 by programming-idioms.org:
New Go implementation by user [programming-idioms.org]

Version 27

2017-04-29, 07:10:55

Version 28

2017-06-09, 10:38:29

Idiom #94 Print type of variable

Print the name of the type of x. Explain if it is a static type or dynamic type.

This may not make sense in all languages.

Idiom #94 Print type of variable

Print the name of the type of x. Explain if it is a static type or dynamic type.

This may not make sense in all languages.

Code
fmt.Printf("%T", x)
Comments bubble
This prints the dynamic type of x.
Doc URL
https://golang.org/pkg/fmt/
Demo URL
https://play.golang.org/p/bKtely3iID