I want a default value to be assigned when pressing Enter without giving one.
From my experience Go Playground doesn't handle fmt.Scan inputs, so I quote the code here:
(If it's possible, tell me how please!)
package main
import (
"fmt"
"time"
)
func main() {
t := 0
fmt.Print("seconds? ")
fmt.Scan(&t)
time.Sleep(time.Duration(t) * time.Second)
fmt.Println("in", t)
}
I've initialized the value of t to 0 but when I press Enter without giving a value the program waits until I give some value. I'm not interested in error checking (if that's possible). I just want the code to accept a single Enter press, as 0 Enter.