package mainimport ( "fmt" "time")const MAXSLEEP = 128func main() { for numsec := 1; numsec <= MAXSLEEP; numsec <<= 1 { // TODO if numsec <= MAXSLEEP/2 { time.Sleep(time.Second * time.Duration(numsec)) fmt.Println("slepp time(s):", numsec) } }}
package mainimport ( "fmt" "time")const MAXSLEEP = 128func main() { for numsec := 1; numsec <= MAXSLEEP; numsec <<= 1 { // TODO if numsec <= MAXSLEEP/2 { time.Sleep(time.Second * time.Duration(numsec)) fmt.Println("slepp time(s):", numsec) } }}
相关课程