While Loops
explain while loop
- simple example
Compare to for loop
- for loops are a coding shortcut for a while loop with a counter
- examples
- loop forever until exit condition
- exit condition needs to be known in advance
- explain exactly when the loop exits
while using arrays
- simple array example
- using a boolean
- (possibly using the result of a method call)
do.. while
- explain
- difference to while loop
- using arrays
- danger of always doing one iteration
big example
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment