From a860ef279665c733de81dd1065b464d1d1e673f0 Mon Sep 17 00:00:00 2001 From: sebastian Date: Wed, 4 Oct 2023 15:11:24 +0200 Subject: [PATCH] Section6.57 --- Section6/56.go | 9 +++++++++ Section6/57.go | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 Section6/56.go create mode 100644 Section6/57.go diff --git a/Section6/56.go b/Section6/56.go new file mode 100644 index 0000000..66b6d26 --- /dev/null +++ b/Section6/56.go @@ -0,0 +1,9 @@ +package main + +import "fmt" + +func main() { + for i := 0; i < 10; i++ { + fmt.Println(i) + } +} diff --git a/Section6/57.go b/Section6/57.go new file mode 100644 index 0000000..630294a --- /dev/null +++ b/Section6/57.go @@ -0,0 +1,19 @@ +// Replaces while loop in GO +package main + +import "fmt" + +func main() { + j := 10 + for j >= 0 { + fmt.Println(j) + j-- + } + + // INFINITE LOOP + sum := 0 + for { + sum++ + } + fmt.Println(sum) +}