Skip to content

Instantly share code, notes, and snippets.

@hi-manshu
Last active July 12, 2018 16:05
Show Gist options
  • Save hi-manshu/03acdc85324e486da0b3f97564fbe66e to your computer and use it in GitHub Desktop.
Save hi-manshu/03acdc85324e486da0b3f97564fbe66e to your computer and use it in GitHub Desktop.
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