Lecture 3: loops
- booleans and operators
- loops
booleans
- type bool
- implicit conversion (nonzero is true!)
- relational/comparison operators (watch out for = and ==)
- boolean operators (and,or,not)
loops
- iteration in Scheme: factorial
- iteration as updating an environment
- while loops in C
- tail recursion
- factorial in C
- prime number test
other kinds of loops
- for (repeat a code -- handles update for you)
- do while
- what loop do I use?
syntax gotcha: curly braces
- if { s1; s2; } vs. if s1; s2;
- same for other blocks of code