Join David Gassner for an in-depth discussion in this video Getting input from the console, part of Learning Go.
- I've previously described how to use the FMT package…to output and format strings.…The package also has input methods…that you can use to analyze strings:…the scan methods.…These are designed to get input…from the console, files, variables, and other input sources…and automatically separate values from each other…by looking for space characters.…On first appearance, these functions look like…they might be useful for getting user input…in a console application.…In this file, consoleinput.go,…I only have an import statement…and in the main function,…I'll declare a variable named S…and set its type as a string.…
Then I'll use a function of the format package,…named Scanln.…It looks like this: fmt.Scanln.…And then I'll pass in the string variable,…but I'm not going to pass it in by value,…as you typically do.…Instead, I'll pass it in as a reference.…The syntax for that is the name of the variable…with an ampersand prefix.…Now, that function will operate on the same reference…that I declared in the calling function.…
- 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
Programming the Google App Engine with Javawith Patrick Royal2h 4m Intermediate
Google App Engine Essential Trainingwith Joseph Lowery3h 26m Intermediate
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.