Skip to content

Understanding The Basic Data Types In Go


Objective

Learn the basic data types in Go

Data Types

For a new programmer, data types sounds geeky enough, but really there isn't much to it, lets see below how it works out.

If I ask you, what's your name ? Yours answer would be something like this:

My name is Bond, James Bond

This is nothing but data type of string, in plain english string is nothing but a collection of characters.

Now, if I ask you, how old are you ? You would say something like:

28

Since age is a number or a digit, it belongs to the data type of int , int stands for integer which means whole numbers without decimals.

Let's get more curious and ask James Bond, you have a nice watch, how much did it cost ? He would say:

$ 105.23

Now you see nice it has a decimal value, it is called as a data type of float, float is just another fancy way of saying, its a digit with decimal values.

James Bond is getting irritated with our question, so lets ask a final question and wrap it up, lets ask, is it true that you are licensed to kill ? He would say

True

True is neither a digit or a string, its a condition, so it belongs to the data type of boolean, boolean values can be only True or False.

In reality the above data types are of very basic types, Go has much more to it, also Go has different varieties of int, float, etc. But for now lets take it easy, we will see different data types as we progress with our code.

Next

So now you know what are the basic data types in Go, in the next section we will start using them by declaring something called as variables and constants.

Please Donate ❤️

All the work is provided free of cost and completely open source, but it needs your support and love to keep the activity sustainable.

Any support is genuinely appreciated, you can help by sending a small donation by clicking the below link:

PayPal