Skip to Content
Get Programming with Go
book

Get Programming with Go

by Nathan Youngman, Roger Peppe
September 2018
Beginner
360 pages
9h 28m
English
Manning Publications
Content preview from Get Programming with Go

Lesson 7. Whole numbers

After reading lesson 7, you’ll be able to

  • Use 10 types of whole numbers
  • Choose the right type
  • Use hexadecimal and binary representations

Go offers 10 different types for whole numbers, collectively called integers. Integers don’t suffer from the accuracy issues of floating-point types, but they can’t store fractional numbers and they have a limited range. The integer type you choose will depend on the range of values needed for a given situation.

Consider this

How many numbers can you represent with two tokens?

If the tokens are individually identifiable by position, there are four possible permutations. Both tokens, neither token, one token, or the other token. You could represent four numbers.

Computers ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Go Web Programming

Go Web Programming

Sau Sheong Chang
Java Coding Problems

Java Coding Problems

Anghel Leonard

Publisher Resources

ISBN: 9781617293092Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentErrata PagePurchase Link