Computer Science Canada

exiting loop

Author:  person [ Sat Feb 05, 2005 11:03 am ]
Post subject:  exiting loop

code:

        for h : 1 .. 520 by 80
            for i : 1 .. 560 by 80
                m += m
                if c = 1 + m and whatdotcolor (40 + h, 40 + i) not= 14 and    whatdotcolor (40 + h, 40 + i) not= 1 then
                    drawfilloval (40 + h, 40 + i, 35, 35, 1)
                end if
            end for
        end for


i want this code to exit when the circle is drawn, so how do i do that

Author:  Delos [ Sat Feb 05, 2005 11:41 am ]
Post subject: 

You could use a boolean that would be set to true after the circle is drawn, which itself would be checked at the end of each respective loop.

Author:  Viper [ Sat Feb 05, 2005 1:15 pm ]
Post subject: 

couldent u jus do
"exit when h(or i)>= wut ever

Author:  mike200015 [ Sat Feb 05, 2005 1:44 pm ]
Post subject: 

Quote:
for h : 1 .. 520 by 80
for i : 1 .. 560 by 80
m += m
if c = 1 + m and whatdotcolor (40 + h, 40 + i) not= 14 and whatdotcolor (40 + h, 40 + i) not= 1 then
drawfilloval (40 + h, 40 + i, 35, 35, 1)
end if
end for
end for

cant you also jus write exit after drawfilloval?? i think that might work, im not totally sure tho.

Author:  cool dude [ Sat Feb 05, 2005 2:28 pm ]
Post subject: 

mike200015 wrote:
Quote:
for h : 1 .. 520 by 80
for i : 1 .. 560 by 80
m += m
if c = 1 + m and whatdotcolor (40 + h, 40 + i) not= 14 and whatdotcolor (40 + h, 40 + i) not= 1 then
drawfilloval (40 + h, 40 + i, 35, 35, 1)
end if
end for
end for

cant you also jus write exit after drawfilloval?? i think that might work, im not totally sure tho.



if all of that is in a loop than u could use exit otherwise u should do it like "Delos" said use a boolean and before the loop set it to false and then after the oval is drawn set it to true


: