push all exercices

This commit is contained in:
lbenedar
2026-02-21 14:09:13 +03:00
commit a94d994b8c
72 changed files with 787 additions and 0 deletions

BIN
ch8/1/ch8_1.exe Normal file

Binary file not shown.

27
ch8/1/ch8_1.go Normal file
View File

@@ -0,0 +1,27 @@
package main
import "fmt"
type Number interface {
~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 |
~uint32 | ~uint64 | ~float32 | ~float64
}
func NumDoubler[T Number](val T) T {
return val * 2
}
func main() {
val := 10.3
fmt.Println(val)
val = NumDoubler(val)
fmt.Println(val)
val = NumDoubler(val)
fmt.Println(val)
val = NumDoubler(val)
fmt.Println(val)
val = NumDoubler(val)
fmt.Println(val)
val = NumDoubler(val)
fmt.Println(val)
}

3
ch8/1/go.mod Normal file
View File

@@ -0,0 +1,3 @@
module ch8_1
go 1.25.0