Added cool delay to star printing
This commit is contained in:
parent
4913df663a
commit
b93f7e445e
|
@ -1,11 +1,17 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
var delayer time.Duration = 50
|
||||
|
||||
// Drawing a line of asterisks
|
||||
func line(num int) {
|
||||
for i := 0; i < num; i++ {
|
||||
fmt.Printf("* ")
|
||||
time.Sleep(delayer * time.Millisecond)
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
|
@ -15,6 +21,7 @@ func square(num int) {
|
|||
for i := 0; i < num; i++ {
|
||||
for i := 0; i < num; i++ {
|
||||
fmt.Printf("* ")
|
||||
time.Sleep(delayer * time.Millisecond)
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
|
@ -25,6 +32,7 @@ func flag(num int) {
|
|||
for a := 0; a < num; a++ {
|
||||
for i := -1; i < a; i++ {
|
||||
fmt.Printf("* ")
|
||||
time.Sleep(delayer * time.Millisecond)
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue