Using a Loop Invariant to Help Think About a Program

See the original posting on Dr Dobbs

Last week, I talked about how to write a loop invariant. I would like to continue this discussion by paraphrasing a beautifully elegant example that Dijkstra used in <i>A Discipline of Programming</i>.