Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
32
Task/Loops-Nested/Go/loops-nested.go
Normal file
32
Task/Loops-Nested/Go/loops-nested.go
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
values := make([][]int, 10)
|
||||
for i := range values {
|
||||
values[i] = make([]int, 10)
|
||||
for j := range values[i] {
|
||||
values[i][j] = rand.Intn(20) + 1
|
||||
}
|
||||
}
|
||||
|
||||
outerLoop:
|
||||
for i, row := range values {
|
||||
fmt.Printf("%3d)", i)
|
||||
for _, value := range row {
|
||||
fmt.Printf(" %3d", value)
|
||||
if value == 20 {
|
||||
break outerLoop
|
||||
}
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue