Posted 08 October 2012 - 01:32 AM
I am building a computercraft cash register but I can't figure out how to get the code to loop to the beginning. Someone help!
money = 100
term.clear()
term.setCursorPos(1,1)
print("---------------")
print("-cash register-")
print("---------------")
write "Type in command: "
input = read()
if input == "Add cash" then
term.clear()
term.setCursorPos(1,1)
print("----------")
print("-Add Cash-")
print("----------")
write "Add Ammount: "
add = read("$")
money = money + add
else
if input == "Check cash" then
term.clear()
term.setCursorPos(1,1)
print("You have this much money.."..money)
sleep(2)
term.clear()
else
if input == "Remove cash" then
term.clear()
term.setCursorPos(1,1)
print("-------------")
print("-Remove cash-")
print("-------------")
write "Subtract Ammount: "
remove = read("$")
money = money - remove
end
end
end