golang - 2
Published: 2024-03-03 07:27:49

## TYPES

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7b53cmy6f89oxisyuv2a.png)

- Variable --> to store value.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w1pus32168wsqglk2bhr.png)

- strongly typed language.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2x8pk0uw68qmgcs0jyog.png)

> **_INT_**

- These are used to declare INTEGER values.

- upending two string in INT

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yr14d4ss7dx5nk6277tx.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dkgaca8kb4lzrnd6hxp7.png)

- Testing with Negative values

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o2ewcv75x8aci1z13g39.png)

> **_FLOAT_**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u93q7v3102r4hlxrbngb.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ks9qniph22ku7qr12oac.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r4n8dd4xcipslxy5vk19.png)

> **_STRING_**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/94vm4rlwh56vzsnang96.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/drc43807ve7y35lr3cjj.png)

> **_COMPLEX_**

- It provides the real and imaginary value.

```
package main
import (
	"fmt"
)
func main() {
	var i complex64 = 2
	fmt.Println(i)
}
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/asi5qnaqo27rgner9mdj.png)

> **_BOOLEAN_**

- Default value is FALSE.

```
package main
import (
	"fmt"
)
func main() {
	var i bool
	fmt.Println(i)
}
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lr9dgkmr1q76rs0hqff3.png)

- Where it's used ? We can test with Condition.

```
package main
import (
	"fmt"
)
func main() {
	var i bool = 4 > 2
	fmt.Println(i)
}
```
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8bzf7ur3r1pwp1q5lw5l.png)

## CONSTANT

- You can define , and it can't be changed.

## TYPE CONVERSION 

- It can convert from one type to another type.


## Notes

1. 1 byte = 8 bit ( high bit will be allocated to --> signature , 2 power 7 = 0 to 127 --> it accepts , range = -127 to +127 ) Eg., var i int8
2. uint --> Reservation will be ignored. So 0 to 128 , also negative value will not be assigned. --> unsigned Integer 
3. 1 byte = uint8
4. rune = int32
5. Typed system is important because of the allocation of the memory.
6. Eg., Bank Balance can be negative, if you take loan && The element with the lowest freezing point is helium, which freezes at a temperature of approximately -272.2 degrees.
7. The Two’s Complement has unaltered positive numbers just like Sign-and-Magnitude and One’s Complement methods. The negative number is obtained by first determining the one’s complement of the relevant positive number and then adding “1” to it. The range of numbers is -128 to 0 to +127 and includes only one zero in the range. 

## Reference & Important Sites

https://go.dev/tour/basics/1
https://forums.tamillinuxcommunity.org/t/lets-learn-golang/1725/2
https://gitlab.com/mohan43u/letslearngolangdocs/-/blob/master/week0.org
https://go.dev/tour/list