Posted 12 June 2012 - 10:21 PM
Hi, this is probably a fundamental error, but I am unable to see what I am doing wrong.
Purpose of this code is for the turtle to simply move the entered number of blocks.
Instead of stopping when it is supposed to break, it continues forever.
Code I have tried using:
ToWalk = 0
Walked = 0
print("How far should the turtle walk?")
ToWalk = (io.read())
while true do
if Walked == ToWalk then
break
else
Walked = Walked + 1
turtle.forward()
end
end
Purpose of this code is for the turtle to simply move the entered number of blocks.
Instead of stopping when it is supposed to break, it continues forever.
Code I have tried using:
ToWalk = 0
Walked = 0
print("How far should the turtle walk?")
ToWalk = (io.read())
while true do
if Walked == ToWalk then
break
else
Walked = Walked + 1
turtle.forward()
end
end