TYPES
- Variable --> to store value.
- strongly typed language.
INT
These are used to declare INTEGER values.
upending two string in INT
- Testing with Negative values
FLOAT
STRING
COMPLEX
- It provides the real and imaginary value.
package main
import (
"fmt"
)
func main() {
var i complex64 = 2
fmt.Println(i)
}
BOOLEAN
- Default value is FALSE.
package main
import (
"fmt"
)
func main() {
var i bool
fmt.Println(i)
}
- Where it's used ? We can test with Condition.
package main
import (
"fmt"
)
func main() {
var i bool = 4 > 2
fmt.Println(i)
}
CONSTANT
- You can define , and it can't be changed.
TYPE CONVERSION
- It can convert from one type to another type.
Notes
- 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
- uint --> Reservation will be ignored. So 0 to 128 , also negative value will not be assigned. --> unsigned Integer
- 1 byte = uint8
- rune = int32
- Typed system is important because of the allocation of the memory.
- 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.
- 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