Join David Gassner for an in-depth discussion in this video Exploring variables, constants, and types, part of Learning Go.
- [Instructor] As with all programming languages,…you can store data in memory in Go…using variable and constants.…Go is a statically typed language.…You have to set the type of each variable…during the compilation process,…and you can't change them at runtime.…But with Go syntax you can set types…either explicitly or implicitly.…This is similar in functionality to C#…which also offers both choices.…Here's the syntax for explicit typing.…
Declare your variables using the var keyword…and a single equals character as the assignment operator.…When you use explicit typing,…setting the initial value of the variable is optional.…This bit of code creates a variable named anInteger,…sets its data type to int…and its initial value to 42.…If I drop off the equals assignment operator…and the literal number,…then the default value would be zero.…And here's a string variable.…Once again, I start with the var keyword,…then the variable name and the data type,…and then after the assignment operator the literal value.…
The advantage of explicit typing is that it's very readable…
- 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.