6

uint8 x = 255;

x += 10;

Is x going to be 0 or 9?

eth
  • 85,679
  • 53
  • 285
  • 406
manidos
  • 4,298
  • 3
  • 31
  • 55

1 Answers1

8

x will be 9.

Use this code and How to quickly test a Solidity function?

contract C {
    function test() returns(uint) {
        uint8 x = 255;
        x += 10;
        return x;
    }
}

Decoded: uint256: 9

eth
  • 85,679
  • 53
  • 285
  • 406
  • You're a life saver! Thank you, good sir! You're like a kind wizard that makes dumb contracts smart)) – manidos Jul 27 '16 at 08:55