Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "time"
- )
- func main() {
- go Remind("Time to eat", 10*time.Second)
- go Remind("Time to work", 30*time.Second)
- Remind("Time to sleep", 60*time.Second)
- }
- func Remind(text string, delay time.Duration) {
- for {
- time.Sleep(delay)
- currentTime := time.Now()
- fmt.Printf("The time is %s: %s \n", currentTime.Format("15:04:05"), text)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement