While loop



package main
import (
    "fmt"
    "time"
)

func main(){
    sum := 1
    for sum < 10 {
        sum += sum
        fmt.Println(sum)
        time.Sleep(300 * time.Millisecond)
    }
}
Remove the conditions and you get an infinite loop
import (
    "fmt"
    "time"
)

func main(){
    sum := 1
    for {
        sum += sum
        fmt.Println(sum)
        time.Sleep(300 * time.Millisecond)
    }
}

4 comments:

  1. Thanks for sharing this Information blog. Recently I have completed Php Training Courses in chennai at a leading Company. It's really useful for me to make a
    bright Future career. Visit Us,Php Training Institute Chennai. besant technologies reviews | besant technologies reviews | besant technologies reviews

    ReplyDelete
  2. It is really a great work and the way in which u r sharing the knowledge is excellent.
    Thanks for helping me to understand basic concepts. As a beginner in dot net programming your post help me a lot.Thanks for your informative article.Dot Net Training with placement | Dot Net Training in chennai

    ReplyDelete