-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patholdlady.go
50 lines (43 loc) · 1.18 KB
/
oldlady.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"fmt"
)
func main() {
intro := "I know an old lady who swallowed a "
swallow := "She swallowed the "
catch := " to catch the "
spider := " that wriggled and jiggled and tickled inside her."
var animal = []string{"fly", "spider", "bird", "cat", "dog", "goat", "cow", "horse"}
var action = []string{"I don't know why she swallowed the fly. Perhaps she'll die.",
"It wriggled and jiggled and tickled inside her.",
"How absurd to swallow a bird!",
"Imagine that, to swallow a cat!",
"What a hog, to swallow a dog!",
"Just opened her throat and swallowed a goat!",
"I don't know how she swallowed a cow!",
"She's dead, of course!"}
for x, _ := range animal {
fmt.Printf("%v%v\n%v\n", intro, animal[x], action[x])
if x+1 == len(animal) {
break
}
if x > 0 {
fmt.Printf("%v%v%v%v", swallow, animal[x], catch, animal[x-1])
if x == 2 {
fmt.Printf("%v", spider)
}
fmt.Printf("\n")
for i := x - 1; i > 0; i-- {
fmt.Printf("%v%v%v%v", swallow, animal[i], catch, animal[i-1])
if i == 2 {
fmt.Printf("%v", spider)
}
fmt.Printf("\n")
}
}
if x >= 1 {
fmt.Printf("%v\n", action[0])
}
fmt.Printf("\n")
}
}