Hey guys in this post, we will discuss the different datatypes provided by Golang.
- Integer type
- Floating type
- String
- Boolean
package main
import (
"fmt"
"reflect"
)
func main() {
fmt.Println(reflect.TypeOf(1))
fmt.Println(reflect.TypeOf(9.5))
fmt.Println(reflect.TypeOf("Just a String"))
fmt.Println(reflect.TypeOf(true))
}
Output:
PS C:\workspace\go lang workspace> go run .\Types.go int
float64
string
bool
TypeOf()
is present in the reflect
package and it will return the type of the value.