up till 08/01/2025

This commit is contained in:
orejav
2025-01-09 10:11:54 +02:00
parent f39c523d4e
commit 3c12255382
2 changed files with 8 additions and 19 deletions

View File

@@ -3,15 +3,9 @@ package main
import "fmt"
func main() {
// Initialize the variable before the loop
value := 0
for i := 0; i < 5; i++ {
// Change its value within the loop
value += i
fmt.Println("Current Value:", value) // Use the variable here
}
fmt.Println("Final Value:", value) // Still accessible after the loop
slice := []int{}
for i := range slice {
fmt.Println(i)
}
}