feat: init & playaround

This commit is contained in:
2026-03-01 21:03:32 +01:00
commit de9137b84e
10 changed files with 313 additions and 0 deletions

35
go-by-example/for/for.go Normal file
View File

@@ -0,0 +1,35 @@
package main
import "fmt"
func main() {
// Basic
i := 1
for i <= 3 {
fmt.Println(i)
i = i + 1
}
// Classic initial/conditional/after loop
for j := 0; j < 3; j++ {
fmt.Println(j)
}
// or modernized
for j := range 3 {
fmt.Println("range", j)
}
// Will run until break
for {
fmt.Println("Break")
break
}
// Continue
for n := range 10 {
if n%2 == 0 {
continue
}
fmt.Println(n)
}
}