Source File: ex09b/main.go

package main

import (
    "fmt"
)

func main() {
    // first style loops like an if-statement
    i := 0
    for i < 10 {
        fmt.Println("loop", i)
        i++
    }

    fmt.Println("------ first loop ended")

    // second style does all of that for you
    for i := 0; i < 10; i++ {
        fmt.Println("loop", i)
    }

    fmt.Println("------ second loop ended")

    // third style loops forever, uncomment this to see
    /*
    for {
        fmt.Println("Noooooooooooo")
    }
    */
}