practice/go/count/main.go

30 lines
393 B
Go
Raw Permalink Normal View History

2017-11-14 05:55:02 -07:00
// 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)
}
}