Added cool delay to star printing

This commit is contained in:
raul 2024-02-01 07:13:28 +00:00
parent 4913df663a
commit b93f7e445e
1 changed files with 9 additions and 1 deletions

View File

@ -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")
}