I’m laughing at myself ruefully over a silly mistake I just made. I had a variable, of type uint, set to a value that ended up (for obscure reasons) being -1.
Now as the name of the type suggests, uints cannot be negative. So if you try to set them to a value less than zero, it just turns it into a silly arbitrary number (-1, for instance, is 4294967295) that I assume is based on the number of bits available to the memory slot for that value, with the binary digits flipped into ones instead of zeroes.
Incredibly obvious mistake but might be of use to other mathematically-challenged developers like myself.




I don’t really get the benefit of using unit, i mean uint (I always tend to type it as unit). I was quite into the new data type in the beginning but later realized I don’t really benefit out of it much, same memory size and some say it’s slower than just int. Plus I also get tired of thinking whether the variable can be a negative number or not.