fmt
Package
The fmt
package in Go provides formatted I/O functions similar to C’s printf
family. It is one of the most commonly used standard libraries in Go and supports:
- Printing to the console (
Print
,Printf
,Println
) - Formatting strings (
Sprintf
) - Reading input (
Scan
,Scanf
) - Formatting values with verbs (
%d
,%s
,%v
, etc.)
Basic Output Functions
Function | Description |
---|---|
fmt.Print() | Prints values to standard output without a newline |
fmt.Println() | Prints values followed by a newline |
fmt.Printf() | Prints formatted text using verbs |