Ask your own question, for FREE!
Computer Science 15 Online
OpenStudy (anonymous):

Which are true about for loops? A. You need to specify the start value and a terminating condition. For example: the loop start with $x = 3 and ends when $x is less than 10 B. They are exactly the same a while loops. C. On each iteration of the for loop, the indexing variable usually, $i, if always incremented by 1 D. $i++ means $i = $i + 1

OpenStudy (anonymous):

Anyone else think B and D?

OpenStudy (espex):

There are varying nuances for each language, but in general you need to set an initial value and a test condition. Quite often when using for loops you will increment your indexing variable. Although not exclusive to for loops, i++ does mean to take the value of i and add 1 to it. The 'for' loop differs from a 'while' loop in that no initial condition is set, the loop runs for as long as the condition is true.

OpenStudy (espex):

I would not be thinking B. :P

OpenStudy (anonymous):

I actually didn't put B ended up with just D lol

OpenStudy (espex):

A and C are probably the most accurate, D is commonly used in for loops but it is not exclusive to them like the conditional statements are.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!