++i
/i++
should be unchecked{++i}
/unchecked{i++}
when it is not possible for them to overflow, as is the case when used in for
- and while
-loops
The unchecked
keyword is new in solidity version 0.8.0,
so this only applies to that version or higher, which
these instances are.
This saves 30-40 gas per loop
Link to code - https://github.com/Cyfrin/2023-07-beedle/tree/main/src/Lender.sol
Code Review
++i
/i++
should be unchecked{++i}
/unchecked{i++}
when it is not possible for them to overflow, as is the case when used in for
- and while
-loops
NeoCrao
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.