From b93f7e445e4e80ef953b086b1630761b9a538766 Mon Sep 17 00:00:00 2001 From: raul Date: Thu, 1 Feb 2024 07:13:28 +0000 Subject: [PATCH] Added cool delay to star printing --- star-shapes/shapes.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/star-shapes/shapes.go b/star-shapes/shapes.go index f62cdb6..229226f 100644 --- a/star-shapes/shapes.go +++ b/star-shapes/shapes.go @@ -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") }