Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
How would you print type of variable in Go?
Home
GoLang
How would you print type of variable in Go?
0
votes
asked
Aug 19, 2022
in
GoLang
by
john ganales
How would you print type of variable in Go?
print-type
golang
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Aug 19, 2022
by
john ganales
You have to use the following code to print the type of a variable:
var a, b, c = 3, 4, "foo"
fmt.Printf("a is of type %T\n", a)
Related questions
0
votes
Q: Explain dynamic type declaration of a variable in Go programming language?
asked
Aug 19, 2022
in
GoLang
by
john ganales
dynamic-variable
golang
0
votes
Q: Explain static type declaration of variable in Go programming language?
asked
Aug 19, 2022
in
GoLang
by
john ganales
static-variable
golang
0
votes
Q: How do you check a variable type at runtime?
asked
Aug 11, 2022
in
GoLang
by
SakshiSharma
variable-type
data-types
golang
0
votes
Q: Does Go programming language support type inheritance?
asked
Aug 19, 2022
in
GoLang
by
john ganales
type-inheritance
golang
0
votes
Q: What is the default value of type bool in Go programming?
asked
Aug 19, 2022
in
GoLang
by
john ganales
default-type
bool-type
golang
0
votes
Q: What form of type conversion does Go support? Convert an integer to a float.
asked
Aug 11, 2022
in
GoLang
by
SakshiSharma
type-conversion
golang
integer
data-types
0
votes
Q: How a pointer is represented in Go?
asked
Aug 19, 2022
in
GoLang
by
john ganales
pointer
golang
0
votes
Q: How to write multiple strings in Go programming?
asked
Aug 19, 2022
in
GoLang
by
john ganales
golang
string-program
0
votes
Q: Explain Go interfaces. What are they and how do they work?
asked
Aug 11, 2022
in
GoLang
by
SakshiSharma
interface
golang
programming
0
votes
Q: Print all permutations of a slice characters or string in Golang
asked
Aug 11, 2022
in
GoLang
by
SakshiSharma
golang
programming
print
...