Scan in a loop



examples/scan-in-loop/scan_in_loop.go
package main

import (
    "fmt"
)

func main() {
    var word string
    for {
        fmt.Scan(&word)
        if word == "bye" {
            fmt.Println("Bye bye")
            break
        }
        fmt.Println(word)
    }
}

examples/scan-in-loop/scan_in_loop.in
hello world
some more bye ls


examples/scan-in-loop/scan_in_loop.out
hello
world
some
more
Bye bye