CSCA08H3 Study Guide - Midterm Guide: Memory Address, Camel Case, Cloning

319 views13 pages

Document Summary

Iteration is the repeated execution of a sequence of statements. It is quite common in computer science because computers often calculate repetitive tasks at a fast rate. Print x: flow of execution for a while statement, evaluate the condition, and yields a true or false. If the condition is false, the while statement is exited and execution is continued at the next statement. If true, the statements in the body are executed and back to step 1: lots of uses for while, sentinel values, validating input, newton"s method, 3n + 1 sequence, eg. n = 10 s= 1 e=0. Print( e is smaller than s : for loops, special loop that performs a series of actions a counted number of times, can control the generation of the index values, form of for loops: Block: more about for loops, automatically stops when you hit the end value. Can easily turn for loop into while loop by moving counter outside: eg.