Join David Gassner for an in-depth discussion in this video Outputting strings with the fmt package, part of Learning Go.
- The first Go package that every gopher,…or Go programmer, learns how to use, is the fmt package.…This package implements a number of functions you can use…to format and print strings…to a variety of output targets.…The Print and PrintLine functions print to the console,…but there are other functions that save…formatted strings to variables, write them to files,…and so on.…You can find the documentation for this package…at golang.org/package/fmt.…
Clicking the index link takes you to a list…of all the functions, and you'll find details…and examples of how to use this package.…And like all documentation files, you can also click…on the package file links to go to the actual source code.…Here are some examples of how you can use…the format package.…I'm working in a file named consoleoutput.go,…where I've declared three string values.…These are all parts of a single sentence.…And I'm going to use the PrintLine function…to put them together into a complete sentence.…
I'll start with fmt.println…and then I'll patch in these three values…
- Installing Go tools
- Creating and compiling a Go workspace
- Exploring variables, constants, and types
- Storing ordered and unordered values
- Grouping related values in structs
- Programming conditional logic and loops
- Defining and calling functions
- Handling errors
- Working with files
- Creating a simple HTTP server
Skill Level Beginner
1. Getting Started
2. Essential Go Skills
3. Managing Simple Values
4. Managing Complex Types and Collections
5. Managing Program Flow
6. Structuring Go Code
7. Working with Files and the Web
Next steps2m 26s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.