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

need help with loop in loop

Started by smurfofiel, 21 January 2013 - 10:16 AM
smurfofiel #1
Posted 21 January 2013 - 11:16 AM
can someone write a piece of code that includes a loop in a loop so their is a loop in a loop wich need to be true before the main loop can go on with looping. because whenever i try it it gives a error, and i have no code for example so i would like it if someone can write a piece of code for me. Thanks for the one that will do it.
Eric #2
Posted 21 January 2013 - 11:21 AM
Punctuation is important in forum posts almost as much as it is scripts. Without really knowing what you want:


local x = 1
while x < 1000 do
    local y = 1
    while y < 10 do
        print(x, y)
        y = y + 1
    end
    x = x * 2
end
smurfofiel #3
Posted 21 January 2013 - 11:22 AM
Punctuation is important in forum posts almost as much as it is scripts. Without really knowing what you want:


local x = 1
while x < 1000 do
	local y = 1
	while y < 10 do
		print(x, y)
		y = y + 1
	end
	x = x * 2
end
ooh thanks i never thought of it this way :)/>