@GareBear One thing that you may want to keep in mind is to always use the proper suffix for whatever value you're sing.
~ is UNSIGNED
%% iBYTE
% is INTEGER
& is LONG
&& is INTEGER64
So ~&& is the suffix for an unsigned integer64.
These suffixes should ALWAYS be used with literal values, if you want to make certain you keep the data types correct. For example, 123456789098 can often get turned into a SINGLE value and become 1.23456E12, losing precision. To make certain you retain that proper value, use the number 123456789098&& instead, to force it to be an integer64 instead.
-1 is a terrible value to mess things up.
As a byte, -1 is represented as &HFF.
As an integer, -1 is &HFFFF.
As a long, -1 is &HFFFFFFFF.
As an integer64, -1 is &HFFFFFFFFFFFFFFFF.
When using literal values, or &H, &B, &O -- which are the equivelant to literal values, just in a different base -- one should ALWAYS suffix them, or else they'll end up with unexpected results like what the programs above generate.
(Full list of suffixes can be found here:
https://qb64phoenix.com/qb64wiki/index.php/TYPE )