Go Printf("%T")

Jmnote (토론 | 기여)님의 2020년 7월 23일 (목) 12:24 판 (새 문서: ==개요== ;Go Printf() %T <source lang='go' run> package main import "fmt" func main() { v := 42 // change me! fmt.Printf("v is of type %T\n", v) } </source> <source lang='go' r...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요

Go Printf() %T
package main

import "fmt"

func main() {
	v := 42 // change me!
	fmt.Printf("v is of type %T\n", v)
}
package main

import "fmt"

func main() {
    fmt.Printf("%T\n", 123)     // int
    fmt.Printf("%T\n", 123.45)  // float64
    fmt.Printf("%T\n", "Hello") // string
    
    fmt.Printf("%T\n", byte(123))       // uint8
    fmt.Printf("%T\n", []byte("Hello")) // []uint8
    
    fmt.Printf("%T\n", true)  // bool
    fmt.Printf("%T\n", false) // bool
    fmt.Printf("%T\n", nil)   // <nil>
}

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}