I could just leave well enough alone here, but I'm curious. In this code, each byte in "wordbytes" is set individually from 0 to 1, ... 3. But why does it start at wordbytes[0], if "i++" is in the brackets? Doesn't this tell solidity we want to change the byte with the index of "i + 1", which would be 1 the first time around - aka the second byte?
bytes wordbytes = new bytes(4);
uint public i;
function setbyte(uint8 _utf8) public {
wordbytes[i++] = byte(_utf8);
}
Doing the code in the following way - in which "i" is incremented after the byte is set - works the same:
bytes wordbytes = new bytes(4);
uint public i;
function setbyte(uint8 _utf8) public {
wordbytes[i] = byte(_utf8);
i++;
}
What tells solidity to increment "i" after "wordbytes[i]" is set in the first example?