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

'end' expected error

Started by TheNic2001, 02 April 2015 - 01:28 PM
TheNic2001 #1
Posted 02 April 2015 - 03:28 PM
how to fix this error?
bios:367: [string "display"]:52: "end" expected (to close "while" at line 10)
Lyqyd #2
Posted 02 April 2015 - 04:12 PM
Split into new topic.

Without seeing your code, the best we can do is point you to the list of common errors.
Square789 #3
Posted 02 April 2015 - 04:46 PM
That means you forgot to close a while loop in your program.

I recommend to shift every structure that has to be ended with an "end" forward with a tabulator like this:

while true do
  ev, p1, p2 = os.pullEvent()
  if ev == "key" then
    print("You pressed a key")
  elseif ev == "char" then
    print("You pressed a key")
    print("With char event")
  else
    print("You fired another event.")
  end
end

But, as Lyqyd said, you can be helped best when you post the program.
Edited on 02 April 2015 - 03:17 PM
KingofGamesYami #4
Posted 02 April 2015 - 06:56 PM
Actually, it means you forgot to close anything requiring an end, ei for, if, function, etc.