/
main.go
41 lines (27 loc) · 923 Bytes
/
main.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
package main
import (
"fmt"
"strconv"
// "weatherwars/request"
"github.com/wsxiaoys/terminal/color"
)
func main() {
var placeNames []string
var placeName string
color.Println("@M Note: @m Use an empty string to begin the war!")
for i := 0; ; i++ {
placeName = ""
// Prompt the user to enter their place name.
fmt.Printf("Place: ")
fmt.Scanf("%s", &placeName)
if (len(placeName) == 0) {
// We've got all of the places we need to begin the process of comparing
// the weather!
break
}
// Voila! We have another place name so let's add it to the array of strings for later.
placeNames = append(placeNames, placeName)
}
// At this point we're ready to begin the whole process.
color.Println("@gPreparing the war with " + strconv.Itoa(len(placeNames)) + " places...")
}