Last active
July 12, 2018 16:05
-
-
Save hi-manshu/03acdc85324e486da0b3f97564fbe66e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| //imported the package fmt | |
| import "fmt" | |
| func main() { | |
| // declare the variable with value = 10 and data-type int | |
| var i int = 10 | |
| // do loop execution | |
| LOOP: for i < 20 { | |
| if i == 15 { | |
| //skip the iteration when value is 15 | |
| i = i + 1 | |
| goto LOOP | |
| } | |
| fmt.Println("value: ", i) | |
| i++ | |
| } | |
| } | |
| >>go run goto.go | |
| >>value : 10 | |
| >>value : 11 | |
| >>value : 12 | |
| >>value : 13 | |
| >>value : 14 | |
| >>value : 16 | |
| >>value : 17 | |
| >>value : 18 | |
| >>value : 19 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment