Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "time"
- )
- func doEvery(d time.Duration, f func(time.Time)) {
- for x := range time.Tick(d) {
- f(x)
- }
- }
- func helloworld(t time.Time) {
- fmt.Printf("%v: Hello, World!\n", t)
- }
- func main() {
- doEvery(2*time.Second, helloworld)
- }
Add Comment
Please, Sign In to add comment