Created
February 17, 2023 16:12
-
-
Save Vitosh/b1634a83a2868466f6f9f959b3785808 to your computer and use it in GitHub Desktop.
For-While-Do-While-Loops-In-Golang.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
fmt.Println("for-loop:") | |
ii := 1 | |
for ii < 100 { | |
fmt.Println(ii) | |
ii++ | |
} | |
fmt.Println("while do loop:") | |
i := 1 | |
for i < 5 { | |
fmt.Println(i) | |
i++ | |
} | |
fmt.Println("do while loop:") | |
j := 10 | |
expression := true | |
for ok := true; ok; ok = expression { | |
fmt.Println(j) | |
j++ | |
if j > 5 { | |
expression = false | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment