Whereas the analysis of loops in imperative programs is, justifiably, dominated by the concept of invariant assertion, we submit a related but different concept, of invariant relation, and show how it can be used to compute or approximate the function of a while loop. We also introduce the concept of invariant function, which is used to generate a broad class of invariant relations.