2024-02-26 11:59:46 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2024-03-03 10:29:50 +01:00
|
|
|
"os"
|
|
|
|
"strconv"
|
2024-03-07 17:59:18 +01:00
|
|
|
"time"
|
2024-02-26 11:59:46 +01:00
|
|
|
)
|
|
|
|
|
2024-02-27 08:04:25 +01:00
|
|
|
var check bool = false
|
|
|
|
var choice string
|
2024-03-03 10:29:50 +01:00
|
|
|
var err error
|
2024-02-27 08:04:25 +01:00
|
|
|
|
2024-03-02 10:00:45 +01:00
|
|
|
func main() {
|
|
|
|
var numChoice int
|
2024-02-27 08:04:25 +01:00
|
|
|
|
|
|
|
for {
|
2024-03-07 17:59:18 +01:00
|
|
|
clear()
|
2024-03-02 10:00:45 +01:00
|
|
|
fmt.Printf("[1] Basic concurrency\n")
|
2024-03-03 10:29:50 +01:00
|
|
|
fmt.Printf("[2] Channels\n")
|
2024-02-26 11:59:46 +01:00
|
|
|
|
2024-03-02 10:00:45 +01:00
|
|
|
fmt.Printf("\rChoose your function: ")
|
2024-03-03 10:29:50 +01:00
|
|
|
|
|
|
|
strChoice := scanLine()
|
|
|
|
numChoice, err = strconv.Atoi(strChoice)
|
|
|
|
catchErr(err)
|
2024-03-02 10:00:45 +01:00
|
|
|
|
|
|
|
switch numChoice {
|
|
|
|
case 1:
|
|
|
|
fun1()
|
2024-03-03 10:29:50 +01:00
|
|
|
os.Exit(0)
|
|
|
|
case 2:
|
|
|
|
fun2()
|
|
|
|
os.Exit(0)
|
2024-03-02 10:00:45 +01:00
|
|
|
default:
|
|
|
|
fmt.Printf("Choose an actual function, please\n")
|
2024-03-07 17:59:18 +01:00
|
|
|
time.Sleep(time.Second)
|
2024-02-27 08:04:25 +01:00
|
|
|
}
|
|
|
|
}
|
2024-03-02 10:00:45 +01:00
|
|
|
|
2024-02-26 11:59:46 +01:00
|
|
|
}
|