Join David Gassner for an in-depth discussion in this video Using math operators and the math package, part of Up and Running with Go.
- Go supports the same set of mathematical operators…that work in other C style languages including…the usual math operators for addition,…subtraction, multiplication and division…and you also get all of the Bitwise operators…that are available in C and Java.…I've previously mentioned one of Go's interesting features,…that it doesn't implicitly convert Numeric types.…So that means that you can't take an integer value…and say, add it to a floating point value…without conversion.…
Take a look at this code.…I have one variable that's an integer…and another one that is a float…and then I try to add them together.…This code will result in an error,…invalid operation because the types are mismatched.…In order to add these values together,…I have to convert them so that they are of the same type…so now I've wrapped the integer value…in a conversion function.…I've turned it into a floating value…and now it matches the other floating value…and I can successfully add the two values together.…
For mathematical operations that go beyond…
- 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.