Golang -Scanner
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
fmt.Print("What is your name ? ")
nama := bufio.NewScanner(os.Stdin)
nama.Scan()
fmt.Print("How old are you ? ")
age := bufio.NewScanner(os.Stdin)
age.Scan()
if umur := age.Text(); umur < "20" {
fmt.Printf("Sorry %s your age is under 20 old age \n", nama.Text())
return
}
fmt.Printf("Congrats %s your age is greater than 20 old age \n", nama.Text())
}
Restu Wahyu Saputra