Use loop for menus

This commit is contained in:
mollusk 2019-12-24 03:54:50 -07:00
parent c6e71553ab
commit 78ea5d261e
3 changed files with 54 additions and 49 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
stockers
./stockers

View File

@ -7,6 +7,7 @@ when isMainModule:
proc casesPerMinute(name: string): string =
var acases: float
var aminutes: float
while true == true:
#stdout.write("Name of employee: ")
#name = readLine(stdin)
@ -17,6 +18,9 @@ when isMainModule:
if cases == "q":
quit(0)
if cases == "m":
echo "TBI"
if re"[^0-9.]" in cases:
echo "I can't do math on words, fucking moron"
quit(1)
@ -42,18 +46,18 @@ when isMainModule:
let cpm: float = acases / aminutes
return(fmt"{name} can throw: {cpm:2.2f} cases per minute")
echo (fmt"{name} can throw: {cpm:2.2f} cases per minute")
proc options(name: string) =
echo(fmt"""
Properties of {name}
Properties of {name}
1) Cases per minute
q) Quit
1) Cases per minute
q) Quit
""")
@ -67,22 +71,23 @@ q) Quit
echo("That is not a property")
proc mainScreen() =
proc mainScreen*() =
echo(fmt"""
------------
| Stockers |
| v0.1.0 |
------------
1) Leroy
2) Perez
3) Eric
4) Emiliano
5) Jamal
6) Joseph
7) Justin
8) Lee
q) Quit
1) Leroy
2) Perez
3) Eric
4) Emiliano
5) Jamal
6) Joseph
7) Justin
8) Lee
q) Quit
""")
@ -109,5 +114,5 @@ q) Quit
quit(0)
else:
echo(fmt"{employee} is not listed above")
while true == true:
mainScreen()

BIN
stockers

Binary file not shown.