Content deleted Content added
→Example: avoid "we"; "easily" is no longer true (an easier example would indeed be preferrable!); why not declare a write-once variable as "const"? |
reduce waffling |
||
Line 15:
</source>
Although the calculation <code>x = y + z</code> and <code>x * x</code> is loop-invariant, precautions must be taken before moving the code outside the loop. It is possible that the loop condition is <code>false</code> (for example, if <code>n</code> holds a negative value), and in such case the loop body should not be executed at all. One way of guaranteeing correct behaviour is using a conditional branch outside of the loop.
<source lang="C">
|