-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainmenu.go
54 lines (46 loc) · 1.11 KB
/
mainmenu.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
51
52
53
54
package main
import (
"fmt"
)
var currListIndex int
var allLists = []shoppingList{}
var currentList = shoppingList{}
func main() {
var on bool = true
var input string
for on {
fmt.Println(" _________________________________")
fmt.Println("| |")
fmt.Println("| Shopping List Application |")
fmt.Println("|_________________________________|")
fmt.Println("")
if len(allLists) == 0 {
fmt.Printf(" No List Available \n")
fmt.Printf(" Press Enter to Create one \n")
fmt.Println(" Key in 0 to exit")
fmt.Scanln(&input)
if input == "0" {
break
}
createShoppingList()
listMenu()
} else {
fmt.Printf(" 1. Create New List\n")
fmt.Printf(" 2. Load Existing List\n")
fmt.Println(" 0. Quit")
fmt.Scanln(&input)
}
if input == "1" {
createShoppingList()
listMenu()
} else if input == "2" {
loadShoppingList()
} else if input == "0" {
break
} else {
fmt.Println("Please key in a valid option")
}
}
fmt.Println("=========================")
fmt.Println("Application Closed")
}