Learning GO

This commit is contained in:
Zakaria
2026-08-31 14:57:35 -04:00
commit d307eb2698
19 changed files with 310 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
package main
import (
"fmt"
)
const name = "Sara"
love := "Kahlousha"
number := 43900900
func main() {
const world = "Mykids"
fmt.Println("Hello,", world)
fmt.Println("I love ", name)
}
+3
View File
@@ -0,0 +1,3 @@
module hello
go 1.23.1
+27
View File
@@ -0,0 +1,27 @@
package main
import (
"fmt"
)
const (
// Create a huge number by shifting a 1 bit left 100 places.
// In other words, the binary number that is 1 followed by 100 zeroes.
Big = 1 << 100
//shoft it right 99 places
Small = Big >> 99
)
func needInt(x int) int {
return x*10 + 1
}
func needFloat(y float64) float64 { return y * 0.1 }
func main() {
fmt.Println(Small)
fmt.Println(needInt(Small))
fmt.Println(needFloat(Small))
fmt.Println(needFloat(Big))
}