Class Crib Notes for CPSC 110                               Brent Dingle

                                    Monday, February 11, 2002

Reminders:

Quiz #2 in class, Wednesday February 13th

Review:

Remember stuff from Friday about nested if’s.

 

New Stuff for today

Loops:

 

While loops exit condition is when expression evals to false.

Repeat until loops exit condition is when the expression evals to true

For loops just count from one number to another number

 

ONLY a repeat-until loop is guaranteed to execute at least one time.

Infinite loops are loops that never terminate

 

Much of the time loops are based on numbers (integers and counting) but not always.

 

Several examples of equivalent loops of each type shown (i.e. a while loop that counts to 5, a repeat loop that counts to 5 and a for loop that counts to 5 – or something along those lines)

 

Misc stuff:

CONST  -- constant declarations

pred()

succ()

Type real assignments:

:

VAR

   r : real;

begin

   r := .73;    { this line fails }

   r := 0.73;   { this line works }

:

 

 

Next time

Quiz in class, be prepared