This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
smurfofiel's profile picture

What is wrong? need help

Started by smurfofiel, 20 January 2013 - 11:22 AM
smurfofiel #1
Posted 20 January 2013 - 12:22 PM
local engines = false

print("engines on or off?")
question == io.read()
while true do
if question == on then
engines = true
term.clear()
break
else
if question == off then
engines = false
term.clear()
break
else
print("You need to say ON or OFF!")
end
end
end

——————-

this is my code can someone tell what is wrong with it.
theoriginalbit #2
Posted 20 January 2013 - 12:25 PM
since you are reading the question from the user, when checking it you should do this

if question == "on" then
  -- code
elseif question == "off" then
  -- code
else
  -- code
end

Also when you get error messages, please post them, it helps us help you quicker…
Also please try to use [code][/code] tags around your code
MudkipTheEpic #3
Posted 20 January 2013 - 01:02 PM
since you are reading the question from the user, when checking it you should do this

if question == "on" then
  -- code
elseif question == "off" then
  -- code
else
  -- code
end

Also when you get error messages, please post them, it helps us help you quicker…
Also please try to use [code][/code] tags around your code
Also ask in the Ask A Pro section. Just sayin' :D/>
theoriginalbit #4
Posted 20 January 2013 - 01:04 PM
Also ask in the Ask A Pro section. Just sayin' :D/>
This one was here first… And I told him not to double post and that I have answered his question here…
MudkipTheEpic #5
Posted 20 January 2013 - 01:06 PM
Also ask in the Ask A Pro section. Just sayin' :D/>
This one was here first… And I told him not to double post and that I have answered his question here…

O. Sorry! :P/>