There is no actual difference; a for loop is just syntactic sugar for a while loop. Which you use depends largely upon which makes the most sense within the context of your source code. The for loop is clearly more flexible, but you will generally use a for loop whenever the number of iterations is known in advance, such as when counting iterations, whereas while loops are generally used whenever the number of iterations is unknown or infinite. Regardless, this has no effect on the efficiency of your code (the machine code maps almost directly, 1-to-1, with a while loop), it's just a question of which makes your code easier to read.
One useful property of a for loop is that you can declare and initialise a control variable in the initial expression. This renders the control variable local to the loop, which is something you cannot achieve with a while loop. This has no effect on the resultant machine code, but by scoping variables within a for loop you automatically enlist the help of the compiler to eliminate bugs.
It should be noted that the do-while loop is similar to a while loop, except that a do-while loop always executes its statements at least once, because the conditional expression is evaluated at the end of each iteration, rather than before each iteration as it is with a while loop. Again, a for loop can be used to achieve a do-while loop, however the do-while loop maps closely with the resultant machine code, and is generally much easier to read.
explain the difference between systems and sub systems
explain the difference between single point & multi point cutting tool
Electronics is a science dealing with electrons emission electrical is a science dealing with electron flow
VDF flooring is suitable for heavy traffic movement and high abrasion. Epoxy flooring requires curing of the concrete before application.
AISI 1018 is usual quality structural grade A216 Gr WCB is Steel Castings, Carbon, Suitable for Fusion Welding, for High- Temperature Service
Difference between define and cons is that, con is disadvantage, whereas define means to elaborate something fully.
Explain the difference between the vassals and the serfs
Explain the difference between a standard sasria cover and the war exclusion under household buildings policy by making use for examples.
Explain the difference between young and mature mountains?
Describe is what it is and explain is why it is as it is
Describe is what it is and explain is why it is as it is
Click link below! You will see examples of paintings from the different periods. This will explain better than words.
explain the difference between cash and credit transaction
Explain the difference between share of customer and customer equity
Illustrate the difference between aromaticity and antiaromaticity with appropriate examples?
explain the difference between systems and sub systems
explain the difference between the two types of feeding?