trying_out_go/cmd/playground/passfail.go

26 lines
335 B
Go
Raw Permalink Normal View History

package main
import (
"fmt"
"log"
"trying_out_go/pkg/keyboard"
)
func passFail() {
fmt.Print("Enter a grade: ")
grade, err := keyboard.GetFloat()
if err != nil {
log.Fatal(err)
}
var status string
if grade >= 60 {
status = "passing"
} else {
status = "failing"
}
fmt.Println("A grade of", grade, "is", status)
}