package main
import (
"bufio"
"fmt"
"os"
)
func Option1() {
fmt.Println("Option1")
}
func main() {
for true {
fmt.Println("Pleae enter text: ")
reader := bufio.NewReader(os.Stdin)
text, _ := reader.ReadString('\n')
if text == "1" {
Option1()
}
}
}
因此,我的代码最终将具有多功能示例:option1 option2 等。每次用户键入 1、2、3 等时,我都会尝试执行一个函数,但我的代码不会打印出 Option1 中的任何内容。
您的帮助将不胜感激。
心有法竹
相关分类