Post

GoLangGoLang

I
Irshad Mohammad

Posted on 28th February 2024|50 views

0
votes

Golang Typeof

How to find the type of an object in golang?

Answers
P
Aryan Sharma

Posted on 28th February 2024

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 

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos