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

<eof> expected error

Started by markandmc, 23 December 2013 - 03:58 AM
markandmc #1
Posted 23 December 2013 - 04:58 AM
So I'm getting this <eof> error everytime I try to run this program

turtle.refuel()
turtle.detect()
	   turtle.dig()
	   turtle.forward()
	   turtle.digUp()
	   turtle.turnRight
	   turtle.dig()
	   turtle.forward()
	   turtle.digUp()
	   turtle.turnLeft()
	   turtle.turnLeft()
	   turtle.forward()
	   turtle.forward() 
	   turtle.forward()
	 
end
Lyqyd #2
Posted 23 December 2013 - 09:30 AM
You need an if statement if you want that turtle.detect to do anything:


if turtle.detect() then
TheOddByte #3
Posted 23 December 2013 - 09:39 AM
Since you don't have an if statement/loop/function or something there is no need for an end there.
But my guess is you want to use 'if turtle.detect() then' as Lyqyd posted above.
markandmc #4
Posted 23 December 2013 - 08:45 PM
Thanks, I'll try.
Alice #5
Posted 23 December 2013 - 11:11 PM
When you're done trying, your code should look like this
Spoiler

turtle.refuel()
if turtle.detect() then
           turtle.dig()
           turtle.forward()
           turtle.digUp()
           turtle.turnRight
           turtle.dig()
           turtle.forward()
           turtle.digUp()
           turtle.turnLeft()
           turtle.turnLeft()
           turtle.forward()
           turtle.forward() 
           turtle.forward()      
end