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

[ERROR] bios:206: end expected (to close to function)

Started by Psidoughnym, 11 June 2012 - 09:05 PM
Psidoughnym #1
Posted 11 June 2012 - 11:05 PM
Hey there, I have been encountering this error for several days could someone tell me WHY it is happening and HOW to correct it.
Thanks in advance and I fully expect that this is the derpiest error and I have just forgotten something but I have looked everywhere and I cannot find a solution.



printMenu()
openDoor()
closeDoor()
function printMenu()
print("CONTROL PANEL")
print("PRESS 1 TO OPEN DOOR")
print("PRESS 2 TO CLOSE DOOR")
end
function openDoor()
while true do
  key, selection = os.pullEvent()
		if selection == "1" then
		rs.setBundledOutput("top",colours.white)  
end

function closeDoor()
while true do
  key, selection = os.pullEvent()
		if selection == "2" then
		redstone.setBundledOutput("top", white(0))	  
		end
end
MysticT #2
Posted 11 June 2012 - 11:24 PM
Try formatting your code correctly, it makes finding this errors really easy. Also, the error message is really clear on what you missed, just some ends:

printMenu()
openDoor()
closeDoor()

function printMenu()
  print("CONTROL PANEL")
  print("PRESS 1 TO OPEN DOOR")
  print("PRESS 2 TO CLOSE DOOR")
end

function openDoor()
  while true do
    key, selection = os.pullEvent()
    if selection == "1" then
      rs.setBundledOutput("top",colours.white)  
    end
  -- missing end here
-- missing end here

function closeDoor()
  while true do
    key, selection = os.pullEvent()
    if selection == "2" then
      redstone.setBundledOutput("top", white(0))
    end
  end
-- missing end here
Psidoughnym #3
Posted 11 June 2012 - 11:54 PM
Thank you very much sir.