Skip to content

Instantly share code, notes, and snippets.

@vwvw
Created June 19, 2017 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vwvw/0f76a0ae475d88b28a90e4cb2dfcc9b3 to your computer and use it in GitHub Desktop.
Save vwvw/0f76a0ae475d88b28a90e4cb2dfcc9b3 to your computer and use it in GitHub Desktop.
This seems like a problem in solidity. PrintUint print number ascending from 1 to 4, instead of 1, 1, 2, 2
pragma solidity ^0.4.0;
contract test {
event PrintUint(uint256 _value);
function testA() {
uint256 x = 5;
uint256[] A;
uint256[] B;
for(uint256 i = 0; i < 2; i++) {
A.push(i);
PrintUint(A.length);
B.push(0);
PrintUint(A.length);
}
}
}
@vwvw
Copy link
Author

vwvw commented Jun 19, 2017

If somebody found this: here is the solution: https://gitter.im/ethereum/solidity?at=59484e8c6462d8493c2c7a00
Declare variable in memory, local variable in storage is messy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment