If i type random2 it runs the else code.
write("Senha: ")
a = read()
if a == "random" then
print("mensage")
if a == "random2" then
print("potato")
end
else
print("Bye bye")
sleep(2)
os.shutdown()
end
write("Senha: ")
a = read()
if a == "random" then
print("mensage")
if a == "random2" then
print("potato")
end
else
print("Bye bye")
sleep(2)
os.shutdown()
end
write("Senha: ")
a = read()
if a == "random" then
print("mensage")
if a == "random2" then
print("potato")
end
else
print("Bye bye")
sleep(2)
os.shutdown()
end
write("Senha: ")
a = read()
if a == "random" then
print("mensage")
elseif a == "random2" then
print("potato")
else
print("Bye bye")
sleep(2)
os.shutdown()
end
Oh ok thanks but i can add unlimited elseifs?this is where indenting helps.write("Senha: ") a = read() if a == "random" then print("mensage") if a == "random2" then print("potato") end else print("Bye bye") sleep(2) os.shutdown() end
what you meant to do was make the next check an elseifwrite("Senha: ") a = read() if a == "random" then print("mensage") elseif a == "random2" then print("potato") else print("Bye bye") sleep(2) os.shutdown() end
Oh ok thanks but i can add unlimited elseifs?this is where indenting helps.write("Senha: ") a = read() if a == "random" then print("mensage") if a == "random2" then print("potato") end else print("Bye bye") sleep(2) os.shutdown() end
what you meant to do was make the next check an elseifwrite("Senha: ") a = read() if a == "random" then print("mensage") elseif a == "random2" then print("potato") else print("Bye bye") sleep(2) os.shutdown() end
if condition then
--Code
elseif othercondition then
--Other code
elseif differentcondition then
--More code
else
--What to do if all the conditions are false
end --You only need one end.
THe loop will be like a screensaver with ASCII Art but when u press L it will leave the screensaver.That depends on what the loop's doing.
post up your code so far so we can give you advice and specific help on how to do thisTHe loop will be like a screensaver with ASCII Art but when u press L it will leave the screensaver.
post up your code so far so we can give you advice and specific help on how to do thisTHe loop will be like a screensaver with ASCII Art but when u press L it will leave the screensaver.
--I will not create a cool screensaver in this code this code is only to show what i know.
repeat
term.clear()
print("O ")
sleep(2)
term.clear()
print(" O")
until
--I Dont know where to put this \/
while true do
local event, param = os.pullEvent()
if event == "L"
os.shutdown()
end
end
local myTimer = os.startTimer(2) -- A timer event will go into the event queue in two seconds. "myTimer" records it's number.
local frameCounter = 1
while true do
local event, param = os.pullEvent() -- Wait for any event.
if event == "timer" and param == myTimer then -- Our two-second timer ended.
term.clear()
term.setCursorPos(1,1)
if frameCounter == 1 then
frameCounter = 2
print("O")
elseif frameCounter == 2 then
frameCounter = 1
print(" O")
end
myTimer = os.startTimer(2) -- Start a new timer and record its new ID number.
elseif event == "key" then -- Instead of our timer ending, our event was triggered by a keypress.
break -- Exit our "while" loop.
end
end