Variable is a placeholder of the information which can be changed at runtime. And variables allow to Retrieve and Manipulate the stored information.
There are 3 ways to find the type of variables in Golang as follows:
- Using reflect.TypeOf Function
- Using reflect.ValueOf.Kind() Function
- Using %T with Printf
Using Percent T with Printf var1 = string var2 = int var3 = float64 var4 = bool var5 = string var6 = map[int]string var7 = complex128 Using reflect.TypeOf Function var1 = string var2 = int var3 = float64 var4 = bool var5 = string var6 = map[int]string var7 = complex128 Using reflect.ValueOf.Kind() Function var1 = string var2 = int var3 = float64 var4 = bool var5 = slice var6 = map var7 = complex128
- Different Ways to Find the Type of an Object in Golang
- Converting a string variable into Boolean, Integer or Float type in Golang
- Atomic Variable in Golang
- Golang program that uses func with variable argument list
- How to declare and access pointer variable in Golang?
- Golang Program that uses func as Local Variable
- How to fetch an Integer variable as String in GoLang?
- How to find the type of Struct in Golang?
- How to add a method to struct type in Golang?
- How to Convert string to integer type in Golang?
- How to convert Int data type to Float in Golang?
- Function that takes an interface type as value and pointer in Golang
- How to Convert string to float type in Golang?
- How to Copy Struct Type Using Value and Pointer Reference in Golang?
- Golang Program to Use Field Tags in the Definition of Struct Type
- How to compare Structs with the Different Values Assigned to Data Fields in Golang?
- Different ways to create an Object in C#
- Different ways to Initialize all members of an array to the same value in C
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.