Last active
March 15, 2017 06:06
-
-
Save tmrtmhr/d17e3b718dc873661188f14b406b1bba to your computer and use it in GitHub Desktop.
GO言語(golang)における各リテラルの型を表示する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
fmt.Printf("%T\n", 123) // 整数リテラル | |
fmt.Printf("%T\n", 123.0) // 浮動小数リテラル | |
fmt.Printf("%T\n", "文字列") // 文字列リテラル | |
fmt.Printf("%T\n", 'ä') // ルーンリテラル | |
fmt.Printf("%T\n", 0i) //虚数リテラル | |
fmt.Printf("%T\n", true) // boolリテラル | |
} | |
// 出力: | |
// int | |
// float64 | |
// string | |
// int32 | |
// complex128 | |
// bool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment