Solidity supports type inference: the type of <code>i</code> in <code>var i = 42;</code> is the smallest integer type sufficient to store the right-hand side value (<code>uint8</code>). Consider a common for-loop pattern:
</p>
<pre>
<code>
for (var i = 0; i < array.length; i++) { /* ... */ }
</code>
</pre>
<p>
The type of <code>i</code> is inferred to <code>uint8</code>. If <code>array.length</code> is bigger than 255, an
overflow will occur. Explicitly define the type when declaring integer variables:
</p>
<pre>
<code>
for (uint256 i = 0; i < array.length; i++) { /* ... */ }
function unseatKing(address a, uint w) view returns (uint){
// <yes> <report> SOLIDITY_VAR_IN_LOOP_FOR f176ab
for (var i = 0; i < 257; i++) {
a=0;
}
for (var i = 0; i < 4; i++) {
a=0;
}
for (var i = 1000; i > 400; i--) {
a=0;
}
}
}
```
### Abstract Syntax Tree
[Click Here](https://astexplorer.net/#/gist/10bc55fd862bc7a9d5793065de870748/b92996017a8b37a4e0e2d96e5998229384f972d8) to view the AST for the above code. Code generated from AST Explorer using _solidity-parser-antlr-0.4.11_