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

Turtle farm loop?

Started by IRyannHD, 04 June 2014 - 02:58 PM
IRyannHD #1
Posted 04 June 2014 - 04:58 PM
Basically I just want the turtle to loop this code, when I type the command name "farm" then it will do the code perfectly but only once.

usually I would do "while true do" at the start but I keep getting the message [string "farm"] :15: 'end' expected (to close 'while' at line 1)

if turtle.detect() then
turtle.select(1) <—bonemeal
turtle.place()
turtle.place()
turtle.place()
end

if not turtle.detect() then
turtle.select(2) <—sapling
turtle.place()
end


That is the code without the "while true do". Can I implement a loop into this code using while true do?
IRyannHD #2
Posted 04 June 2014 - 05:15 PM
I fixed it, figured it out
Blue #3
Posted 04 June 2014 - 05:20 PM
You need to put "end" (without quotes) at the end of your loop.The error 'end' expected means that you need to put 'end' at the end of a function,loop,if statement etc…
EDIT: :ph34r:/>
Edited on 07 June 2014 - 08:34 AM