golang-exercises/golangr/goroutines/main.go

42 lines
555 B
Go

package main
import (
"fmt"
"os"
"strconv"
"time"
)
var check bool = false
var choice string
var err error
func main() {
var numChoice int
for {
clear()
fmt.Printf("[1] Basic concurrency\n")
fmt.Printf("[2] Channels\n")
fmt.Printf("\rChoose your function: ")
strChoice := scanLine()
numChoice, err = strconv.Atoi(strChoice)
catchErr(err)
switch numChoice {
case 1:
fun1()
os.Exit(0)
case 2:
fun2()
os.Exit(0)
default:
fmt.Printf("Choose an actual function, please\n")
time.Sleep(time.Second)
}
}
}