Skip to content

Latest commit

 

History

History
13 lines (11 loc) · 282 Bytes

constant-outcome-of-a-loop.md

File metadata and controls

13 lines (11 loc) · 282 Bytes

Constant Outcome of a Loop

If the outcome of a loop is a constant that can be inferred during compilation, it should not be used.

function constantOutcome() public pure returns(uint) {
  uint num = 0;
  for(uint i = 0; i < 100; i++) {
    num += 1;
  }
  return num;
}