Section6.63
This commit is contained in:
21
Section6/62.go
Normal file
21
Section6/62.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
outer := 19
|
||||||
|
_ = outer
|
||||||
|
people := [5]string{"Helen", "Mark", "Brenda", "Antonio", "Michael"}
|
||||||
|
friends := [2]string{"Mark", "Marry"}
|
||||||
|
|
||||||
|
outer:
|
||||||
|
for index, name := range people {
|
||||||
|
for _, friend := range friends {
|
||||||
|
if name == friend {
|
||||||
|
fmt.Printf("Found a friend %q at index %d\n", friend, index)
|
||||||
|
break outer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt.Println("Next instruction after the break")
|
||||||
|
}
|
||||||
14
Section6/63.go
Normal file
14
Section6/63.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main () {
|
||||||
|
i := 0
|
||||||
|
|
||||||
|
loop:
|
||||||
|
if i < 5{
|
||||||
|
fmt.Println(i)
|
||||||
|
i++
|
||||||
|
goto loop
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user