![]() |
![]() |
![]() |
![]() |
![]() |
|
The definition of power_of_2 that appears in Segment 319
is the best of the lot in many respects: All initialization is 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.