while is equivalent to for
Any for-loop can be rewritten as a while-loop.
for(initialisation; condition; update) {
statement;
}
This loop can be rewritten as a while loop like this.
initialisation;
while(condition) {
statement;
update;
}
Previous slide
Next slide
Back to first slide
View graphic version