A Tour of Go 14
14ページ目
Goで使える型についての話。
package main import ( "fmt" "math/cmplx" ) var ( ToBe bool = false MaxInt uint64 = 1 << 64 - 1 z complex128 = cmplx.Sqrt(-5 + 12i) ) func main() { const f = "%T(%v)\n" fmt.Printf(f, ToBe, ToBe) fmt.Printf(f, MaxInt, MaxInt) fmt.Printf(f, z, z) }
実行結果
bool(false) uint64(18446744073709551615) complex128((2+3i))
複素数はすごいと思った。