## Go Lesson 1. What are Primitive Data Types

Go Lang is **Statically and Strongly Typed** language.
Which means every variable and constant should have a type at compile time.

**Primitive Data types:**
Basic Data Types such as **int, string** and **bool**.

**Composite Data Types:**
Made from basic data types they are e.g array of int.

**Booleans, strings and numbers**

- Boolean has two states only. It either can be
**true**or**false**. - Strings are used to represent text which can be single or multiline.
- Go supports unicode strings.
- Numbers include
**int, floats**and**complex**numbers. - The Concept of Zero values in Go.

Save as “data_types.go

run:
`go data_types.go`

output:

## Go Lesson 2. Integers

**01 Data type int**

- int data type is used to store positive and negative integers without fractions
- eg. 1, 100, -2121, 9121.
- Different kinds of int data types are:
**int8, int16, int32,**etc. - Different int data type have different
**size**in memory and different range of numbers it can store. - The first bit in int data type is used to store the sign of the value and the rest bit stores the value itself.

**Data Type int**

Type | Description | Range |
---|---|---|

int8 | the set of all signed 8-bit integers | -128 to 127 |

int16 | the set of all signed 16-bit integers | -32768 to 32767 |

int32 | the set of all signed 32-bit integers | -2147483648 to 2147483647 |

int64 | the set of all signed 64-bit integers | -9223372036854775808 to 9223372036854775807 |

02 Data Type uint (unsigned int) |

- The
`uint`

data type is used to store`positive integers`

only (*without fractions*) eg. 1, 2349087, 12, 23423545345. - Different kinds of uint data types:
`uint8, unt16, uint32,`

etc - They have different size in memory as well different range of numbers to be stored.
- all bits in the memory are used to store value as such it has large range and can store large positive numbers.

**Data Type uint**

Type | Description | Range |
---|---|---|

uint8 | the set of all unsigned 8-bit integers | 0-235 |

uint16 | the set of all unsigned 16-bit integers | 0 - 65535 |

uint32 | the set of all unsigned 32-bit integers | 0 - 4294967295 |

uint64 | the set of all unsigned 64-bit integers | 0 - 18446744073709551615 |

**Other Related Data Types**

Type | Description |
---|---|

byte | alias for uint8 |

rune | alias for int32 |

uint | either 32 or 64 bits dependant on the system architecture |

int | either 32 or 64 bits dependant on the system architecture |

main.go |