I come from a land of JS and have mostly used things like console.log
or console.error
Now, the tutorial I am following, the instructor over there did something like this
package main
import "fmt"
func main() {
var FirstName = "Varun"
var lastName = "bindal"
fmt.Println(FirstName, lastName)
fmt.Printf("%T", FirstName)
}
Here he did PrintF to check type instead of Println. Initially, I thought that println prints in new Line so I changed my
fmt.Printf("%T", FirstName)
to
fmt.Println("%T", FirstName)
but this logged %T Varun
instead of telling me the type.
I went to their site to figure it out and was either unable to comprehend it or wasn't able to find it out.
Googling lead me know that there are three ways to log/print in Go
- Println
- Printf
So, If someone call tell the difference between three of them?