![]() |
![]() |
![]() |
![]() |
![]() |
|
The definition of powerOf2 that appears in
Segment 427 is the best of the lot in many respects:
declaration and initialization both are done in the initialization part of
the for statement, a simple test of a counter variable occurs in the
testing part of the for statement, the counter variable is
reassigned in the reassignment part of the for statement, and the
computation of the result is separated from the reassignment part. The
for statement is deployed straightforwardly; there are no parlor
tricks.