The
for - while loop equivalence
•If they are equivalent whey bother with the for loop?
•When a programmer
uses a for loop it almost
always means they are counting something:
elements in a list, branches in a
tree, it is almost always something discrete.
•Programmers use a
while loop when the terminating
condition is not so clear, for example
reading input from a user.
•
•