Sobes.tech
Intern — Middle

Deferred output of numbers using a blocking function

livecode

Task condition

It is necessary to output numbers from 1 to 10 using the ready-made function printNumber(n int), which:

  • outputs the given number;
  • pauses for time.Sleep(time.Second) before printing.
package main
        
import (
        "fmt"
        "time"
        )   

func main() {
    
}

func printNumber(n int) {
    time.Sleep(time.Second)
    fmt.Println(n)        
}