Compare and contrast the while and for iteration statements.

What will be an ideal response?


The while and for repetition statements repeatedly execute a statement or set of
statements as long as a loop-continuation condition remains true. Both statements
execute their bodies zero or more times. The for repetition statement specifies the
counter-controlled-repetition details in its header, whereas the control variable in a
while statement normally is initialized before the loop and incremented in the loop's
body. Typically, for statements are used for counter-controlled repetition, and while
statements for sentinel-controlled repetition. However, while and for can each be
used for either repetition type.

Computer Science & Information Technology

You might also like to view...

The correct SQL syntax to sort a table by Last_Name in order of A-Z is ______.

a. SORT BY Last_Name ASCENDING b. ORDER BY Last_Name Down c. ORDER BY Last_Name ASC d. ORDER BY Last_Name DESC

Computer Science & Information Technology

The ________ function is similar to the ________ function, which selects the first character of a text string and continues from left to right

Fill in the blank(s) with correct word

Computer Science & Information Technology

A(n) _______ is done when an older operating system is already loaded and Windows 7 is installed to replace it

Fill in the blank(s) with correct word

Computer Science & Information Technology

Hexadecimal offers 12 possibilities for each digit. _________________________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology