Go TutorialLesson 8Free preview
Go Output
This lesson is part of Go · All levels
Summary
This lesson explains the different ways to display output in Go through an fmt package. The fmt.Println function prints values with spaces and new lines, fmt.Print without new lines, and fmt.Printf supports special formats such as %d, %s, and %v. To form a string without directly printing, use fmt.Sprintf.
Key points
- Fmt.Println adds the space between the values and the new line at the end
- Print without automatic spacing and without new lines
- Fmt.Printf uses verb formats such as %d (number), %s (string), and %v (any value)
- Returns the resulting format string without printing to the screen
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.