Posted on 10th September 2024|58 views
How to find the type of an object in golang?
Posted on 10th September 2024| views
Here is how you do it
Package main
import(
"ftm"
"reflect"
)
func main(){
obj1 = “hello”
obj2 = 20
obj3 = 15.56
ftm.println(reflect.TypeOf(obj1))
ftm.println(reflect.TypeOf(obj2))
ftm.println(reflect.TypeOf(obj3))
}
Output:
string
int
float64