What is fmt in Golang ?
fmt is a built-in package in Golang that provides functions for formatting and printing data. It is often used to print output to the console or to format strings for display.
Some of the functions provided by the fmt package include:
fmt.Print(): prints a string to the console without a trailing newline
fmt.Println(): prints a string to the console with a trailing newline
fmt.Printf(): formats a string based on a format string and arguments, similar to the printf function in C
The fmt package also provides functions for formatting and printing other data types, such as integers, floats, and booleans, as well as more advanced types such as structs and maps. It is a very useful package for debugging and displaying output from Golang programs.
Here is example you can try (click)
Comments
Post a Comment