Go: Added count

This commit is contained in:
Joseph Green 2017-11-14 05:55:02 -07:00
parent 3ca928243e
commit bc068f3dc1
3 changed files with 35 additions and 0 deletions

BIN
go/count/count Executable file

Binary file not shown.

6
go/count/doc.go Normal file
View File

@ -0,0 +1,6 @@
// count project doc.go
/*
count document
*/
package main

29
go/count/main.go Normal file
View File

@ -0,0 +1,29 @@
// 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)
}
}