Integers (int)  

it is a whole number (not a fractional number)  that can be negative or positive 

there is 5 types of intigers as you see bellow

  • int    – >  it’s size depent on Platform  (32/64bit)
  • int8  – > 8bits /1byte -27 to 27 -1 (-128 -> +127)
  • int16 -> 16 bits / 2byte range  -215 to 215 -1 (-32768 -> +32767)
  • int32 -> 32bits / 4byte range  -231 to 231 -1
  • int64 -> 64bits / 8byte -263 to 263 -1

Unsigned Intigers (unit) 

it is a whole number (not a fractional number) but only POSITIVE numbers (unsigned )

there is also 6 types like intigers only  the diffrence these are Positive numbers

  • uint   – >  it’s size depent on Platform  (32/64bit)
  • uint8  – > 8bits /1byte 28 (0 -> +256)
  • uint16  -> 16 bits …
  • uint32
  • uint64
  • uintptr special unsigned intiger. They are large enough to hold any POINTER ADRDRESS. (range ist platform dependent 32/64 bits ? )

 Floats (float32 / float64) 

it is a decimal numbers. Any number in decimal format.   (2,0), (132,12) etc …

there is 2 types depent on range (large)

  • float32 -> 32 bits
  • float64

String (string)

is used to store a sequence of characters (text). String values  represented between double quotes: ” ”

“hi there”  between i and t is a space. it is also chracter !
“1235”  it is also string declared as a string. Numbers here are characters like other there is no possibility to make aritmetical calculation with them

Boolean (bool) 

this type of data can store only 2 values true or false (0 or 1)

default value is false if not explicitly declared

Complex Numbers

It is a combination of the real and imaginary part, where both parts of the complex number will be float type in the go program. There is 2 type of complex numbers depent on their range (large)

var exp = 12 + 23i

(12 Real part)  (23i imaginary part)

There is 2 type of complex numbers :
complex64 (32 bits real + 32bits imaginary)
complex128 (64 bits real + 64bits imaginary)

if complex variable  declared without using data type in the go program’s variable declaration expression, then by default, the type of complex variable will be complex128

 

Byte (byte)

is a unsigned intiger value of 8 bits represents nummbers between 0-255, like uint8

 

Rune 

ist like byte but has a capacity of int32. This integer value is meant to represent a Unicode Code Point