2024-01-20 12:23:39 +01:00
|
|
|
package main
|
|
|
|
|
2024-02-01 08:13:28 +01:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
var delayer time.Duration = 50
|
2024-01-20 12:23:39 +01:00
|
|
|
|
|
|
|
// Drawing a line of asterisks
|
|
|
|
func line(num int) {
|
|
|
|
for i := 0; i < num; i++ {
|
|
|
|
fmt.Printf("* ")
|
2024-02-01 08:13:28 +01:00
|
|
|
time.Sleep(delayer * time.Millisecond)
|
2024-01-20 12:23:39 +01:00
|
|
|
}
|
|
|
|
fmt.Printf("\n")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Drawing a square of asterisks
|
|
|
|
func square(num int) {
|
|
|
|
for i := 0; i < num; i++ {
|
|
|
|
for i := 0; i < num; i++ {
|
|
|
|
fmt.Printf("* ")
|
2024-02-01 08:13:28 +01:00
|
|
|
time.Sleep(delayer * time.Millisecond)
|
2024-01-20 12:23:39 +01:00
|
|
|
}
|
|
|
|
fmt.Printf("\n")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Drawing a flag of asterisks
|
|
|
|
func flag(num int) {
|
|
|
|
for a := 0; a < num; a++ {
|
|
|
|
for i := -1; i < a; i++ {
|
|
|
|
fmt.Printf("* ")
|
2024-02-01 08:13:28 +01:00
|
|
|
time.Sleep(delayer * time.Millisecond)
|
2024-01-20 12:23:39 +01:00
|
|
|
}
|
|
|
|
fmt.Printf("\n")
|
|
|
|
}
|
|
|
|
for i := 0; i < num/2; i++ {
|
|
|
|
println("*")
|
|
|
|
}
|
|
|
|
}
|