File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Roadmap/17 - ITERACIONES/go Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import "fmt"
4
+
5
+ func main () {
6
+ // This Go code snippet is using a `for` loop to iterate over the numbers from 1 to 10.
7
+ for i := 1 ; i < 11 ; i ++ {
8
+ fmt .Printf ("%d\n " , i )
9
+ }
10
+
11
+ // This code snippet in Go is creating an array named `loop` with a length of 10, where each element
12
+ // is of type `uint` (unsigned integer).
13
+ loop := [10 ]uint {}
14
+ for i , _ := range loop {
15
+ fmt .Printf ("%d\n " , i + 1 )
16
+ }
17
+
18
+ // The code snippet you provided is using a `for` loop with a condition to iterate over the numbers
19
+ // from 1 to 10. Here's a breakdown of what it does:
20
+ index := 1
21
+ for index < 11 {
22
+ fmt .Printf ("%d\n " , index )
23
+ index ++
24
+ }
25
+
26
+ // The code snippet `index = 1
27
+ // for ; index < 11; index++ {
28
+ // fmt.Printf("%d\n", index)
29
+ // }` is using a `for` loop in Go to iterate over the numbers from 1 to 10. Here's a breakdown of what
30
+ // it does:
31
+ index = 1
32
+ for ; index < 11 ; index ++ {
33
+ fmt .Printf ("%d\n " , index )
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments