We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Why Go?

Go is my favorite programming language by a good margin.

  • It's fast. Go compiles to a single native binary, and it compiles fast.
  • It's simple. It's a small language without a ton of feature bloat.
  • It's statically typed. The compiler catches type bugs before your code even runs.
  • Concurrency is built in. Goroutines are very powerful, which is a big reason tools like Docker and Kubernetes are written in Go.

We'll dig into all of that later. For now, let's whet your appetite with some more code.

Assignment

Critical bug!

Textio users reported that we're billing them for wildly inaccurate amounts. They're supposed to be billed .02 dollars (2 cents) for each text message sent.

Without changing any of the other lines, fix the math bug in the totalCost calculation.

float64(numMessagesFromDoris) converts the integer to a float64 so it can be used in math with costPerMessage. Go won't mix number types silently. More on that soon.