Question #28547

write a do while loop that displays numbers 1/3/5/7...11

Expert's answer

var i:Number = 1; //setting default value of "i"variable to 1
do //starting the cycle
{
trace(i); //outputting current value of 'i'
i=i+2; //increasing value of 'i' by 2
}
while (i<12); //setting the condition of ending cycle
LATEST TUTORIALS
APPROVED BY CLIENTS