Use fmt.Println for simple output, fmt.Printf for formatted printing, and fmt.Sprintf for formatted string creation in Go.
Use fmt.Println for simple output with newlines, fmt.Printf for formatted strings, and fmt.Sprintf to format strings into variables without printing.
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
fmt.Printf("Value: %d\n", 42)
s := fmt.Sprintf("Formatted: %s", "text")
fmt.Println(s)
}
These functions help you display or create text in your Go programs. Use Println to show simple messages, Printf to mix text with numbers or variables, and Sprintf to build a custom string to save or use later. Think of them as different ways to write notes: one for quick messages, one for filling in blanks, and one for drafting a letter you haven't sent yet.