Jump to content


a;jkosdf's Content

There have been 1 items by a;jkosdf (Search limited from 18-September 20)


By content type

See this member's

Sort by                Order  

#183465 Loop a whole program?

Posted by a;jkosdf on 12 June 2014 - 03:05 AM in Ask a Pro

I have a code and I want it to loop completely again, so I don't have to write the program 5 times.
Here is the code I have currently
for i = 1, 5 do
  turtle.dig()
  turtle.forward()
  turtle.digUp()
end
for i = 1, 1 do
  turtle.turnLeft()
  turtle.dig()
  turtle.digUp()
  turtle.forward()
  turtle.turnLeft()
end
for i = 1, 5 do
  turtle.dig()
  turtle.forward()
end
for i =  1, 1 do
  turtle.turnRight()
  turtle.dig()
  turtle.forward()
  turtle.digUp()
  turtle.turnRight()
end
What I want to do is repeat this code all over again. I guessed i would just put an i = x, y do statement, but that didn't work. I dont know what else i could do, so if anyone could help, that would be nice :)
This is supposed to clear an area, just in case you want to know