Lecture overview -- Keyboard shortcut: 'u'  Previous page: Loop Invariants [Section] -- Keyboard shortcut: 'p'    Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Contracts and Assertions - slide 32 : 32

Loop Invariants

Invariants are not limited to classes

Loop invariants are the primary means to control and reason about loops

div.cs
Division by repeated subtraction.
div-output
Output of the division program.
instrumented-div.cs
Division by repeated subtraction - instrumented with output inside loop.
instrumented-div-output
Output of the instrumented division program.