Skip to content

Instantly share code, notes, and snippets.

@mohdjishin
Last active July 22, 2021 08:05
Show Gist options
  • Save mohdjishin/908a08d6c6d3a1af277eecf9c34193de to your computer and use it in GitHub Desktop.
Save mohdjishin/908a08d6c6d3a1af277eecf9c34193de to your computer and use it in GitHub Desktop.
This is a demonstration of dynamic printing in Golang
package main
import "fmt"
func main() {
var i int = 1
var t bool = true
var a int = 1
for t {
i = i + 1
fmt.Print("\rHello World : ", i)
if i == 1000000 || i%1000000 == 0 {
fmt.Println("\ndo you wanna stop this(1 for yes 0 for No): ")
fmt.Scanln(&a)
if a == 1 {
t = false
} else {
t = true
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment