Learn

Programming languages need to process and organize data. That data is stored as binary numbers (numbers consisting of 0’s and 1’s) in the memory of your computer. In this way, binary numbers are used to represent many different things. Data types are designations by a programming language about what information is being stored. Go comes with a number of basic types, data types built into the programming language. It’s also possible to create your own types that combine these basic types into something more complex, but let’s first cover the data that you can store by default in Go.

Go has three basic categories for numbers:

  • Integers, or ints, are whole/counting numbers. You would use an int to count the number of books on a shelf, the number of products in a warehouse, the number of people on a website, etc…

  • Floating-point numbers, or floats, can include fractional data. You would use a float to store distances, percentages, and other quantities that required division or precision.

  • Complex numbers, complex, are pairs of floating-point numbers where the second part of the pair is marked with the “imaginary” unit i. Complex numbers are particularly useful when reasoning in 2-dimensional space and have other utilizations that make them relevant for involved calculations, but we won’t be discussing them at length in this course.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?