Posted 01 September 2012 - 02:26 PM
i have this digging program called "diggy3" and i want to loop it a set number of times.
I'm new to coding and i can't figure it out.
The code is in the spoiler.
local amountOfTimes = tonumber(read())
amountOfTimes > 0 do
turtle.dig()
turtle.forward()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
turtle.dig()
turtle.digUp()
turtle.up()
turtle.dig()
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.down()
turtle.digDown()
turtle.down()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
turtle.dig()
turtle.up()
turtle.turnLeft()
amountOfTimes = amountOfTimes - 1
if amountOfTimes == 0 then
endif i run this then i get this error (on the screen of my turtle):
bios:206: [string "diggy3"]:3: '='
expected
plz help and thanks in advance.
I'm new to coding and i can't figure it out.
The code is in the spoiler.
Spoiler
print("How many times would you like to run the program?")local amountOfTimes = tonumber(read())
amountOfTimes > 0 do
turtle.dig()
turtle.forward()
turtle.turnLeft()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
turtle.dig()
turtle.digUp()
turtle.up()
turtle.dig()
turtle.turnLeft()
turtle.turnLeft()
turtle.dig()
turtle.down()
turtle.digDown()
turtle.down()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
turtle.dig()
turtle.up()
turtle.turnLeft()
amountOfTimes = amountOfTimes - 1
if amountOfTimes == 0 then
end
bios:206: [string "diggy3"]:3: '='
expected
plz help and thanks in advance.