From ffb74ec6b073722707ad8bbf0985cb89ef5293d0 Mon Sep 17 00:00:00 2001 From: sebastian Date: Sat, 7 Oct 2023 08:55:56 +0200 Subject: [PATCH] Section6.63 --- Section6/62.go | 21 +++++++++++++++++++++ Section6/63.go | 14 ++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Section6/62.go create mode 100644 Section6/63.go diff --git a/Section6/62.go b/Section6/62.go new file mode 100644 index 0000000..aecf319 --- /dev/null +++ b/Section6/62.go @@ -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") +} diff --git a/Section6/63.go b/Section6/63.go new file mode 100644 index 0000000..2f69b4d --- /dev/null +++ b/Section6/63.go @@ -0,0 +1,14 @@ +package main + +import "fmt" + +func main () { + i := 0 + +loop: + if i < 5{ + fmt.Println(i) + i++ + goto loop + } +} \ No newline at end of file