30 lines
393 B
Go
30 lines
393 B
Go
// count project main.go
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func main() {
|
|
total := 0
|
|
|
|
fmt.Printf("First we want to print 1-100 with a for loop\n")
|
|
fmt.Printf("Then We will try to count down recursevly.")
|
|
for i := 0; i < 101; i++ {
|
|
fmt.Println(i)
|
|
total = i
|
|
}
|
|
recCount(total)
|
|
|
|
}
|
|
|
|
func recCount(seed int) {
|
|
fmt.Println(seed)
|
|
if seed == 0 {
|
|
return
|
|
} else {
|
|
recCount(seed - 1)
|
|
}
|
|
|
|
}
|