Posted 18 January 2013 - 10:50 AM
I'm trying to use the following code within a program to have the turtles dig a certain number of times that the user can input.
I'm running into a problem however where the x ~=A sections of the code doesn't actually compare the variable x to the variable A. So the while loops becomes an infinite loop and the counter continues to count past A. How can I prevent this issue?
function CountDepth()
if x ~= A then
x = x+1
end
end
while x ~= A do
CountDepth()
end
I'm running into a problem however where the x ~=A sections of the code doesn't actually compare the variable x to the variable A. So the while loops becomes an infinite loop and the counter continues to count past A. How can I prevent this issue?
function CountDepth()
if x ~= A then
x = x+1
end
end
while x ~= A do
CountDepth()
end