Posted 07 December 2016 - 12:02 AM
                
                
                    Edited on 07 December 2016 - 01:25 PM
                
             
        
length=10
for i=1, length, 1 do --#this loop doesn't have a specified end!
  while turtle.detect() do
    turtle.dig()
    sleep(1)
  end
  while turtle.detectUp() do
    turtle.digUp()
    sleep(1)
  end
  if turtle.dectectDown()
    turtle.digDown()
  end
--# You should add one here!
if turtle.dectectDown() then --# you're missing a then right here
  turtle.digDown()
end