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

EOF error that I cant fix...

Started by Brod8362, 28 March 2015 - 07:26 PM
Brod8362 #1
Posted 28 March 2015 - 08:26 PM
I have been trying to write a code for a nuclear bunker in case of attack, and I have been constantly running into this error:

bios:367: [string "bunker"]:11: '<eof>' expected

I know what this means, however I have not been able to fix it. here is the code:


term.clear()
print("Are You Sure you Want to Do this?")
print("Y/N")
term.setCursorPos(2,3)
if input == "Y" then
redstone.setOutput("bottom", true)
sleep (15)
redstone.setOutput("bottom", false)
peripheral.call("top", "write", "NUCLEAR EMERGENCY")
end
else
if input== "N" then
os.reboot()
end


(Sorry that it isnt in A spoiler i dont know how to do spoilers :/
CrazedProgrammer #2
Posted 28 March 2015 - 08:51 PM
I have been trying to write a code for a nuclear bunker in case of attack, and I have been constantly running into this error:

bios:367: [string "bunker"]:11: '<eof>' expected

I know what this means, however I have not been able to fix it. here is the code:


term.clear()
print("Are You Sure you Want to Do this?")
print("Y/N")
term.setCursorPos(2,3)
if input == "Y" then
redstone.setOutput("bottom", true)
sleep (15)
redstone.setOutput("bottom", false)
peripheral.call("top", "write", "NUCLEAR EMERGENCY")
end
else
if input == "N" then
os.reboot()
end


(Sorry that it isnt in A spoiler i dont know how to do spoilers :/
You need to use elseif instead of end else if:

term.clear()
print("Are You Sure you Want to Do this?")
print("Y/N")
term.setCursorPos(2,3)
if input == "Y" then
  redstone.setOutput("bottom", true)
  sleep (15)
  redstone.setOutput("bottom", false)
  peripheral.call("top", "write", "NUCLEAR EMERGENCY")
elseif input == "N" then
  os.reboot()
end
Edited on 28 March 2015 - 08:03 PM
HPWebcamAble #3
Posted 28 March 2015 - 09:28 PM
I have been trying to write a code for a nuclear bunker in case of attack, and I have been constantly running into this error:

bios:367: [string "bunker"]:11: '<eof>' expected

I know what this means, however I have not been able to fix it. here is the code:

Remember to indent your code, it helps you see missing 'ends'


(Sorry that it isnt in A spoiler i dont know how to do spoilers :/

For code, use code tags:
[.code]
Code here
[./code]
Just take out the period

Spoiler tags:
[.spoiler] [./spoiler]