% define an unsigned 8-bit integer,
%   the maximum integer value that can be 
%   represented using 8 bits is 2^8 - 1 = 255

a = uint8(0); % unsigned 8-bit integer
i = 0;        % default numeric type, double-precision floating point

% increment past its max value
%   and let's see what happens

fprintf('\n');
fprintf('   i    a   hex       bin\n');
fprintf('---- ---- ----- ---------\n');
fprintf('%4d %4d %5x %9s\n', i, a, a, dec2bin(a,8));
a = a + 1;    i = i +1;
fprintf('%4d %4d %5x %9s\n', i, a, a, dec2bin(a,8));
a = a + 1;    i = i +1;
fprintf('%4d %4d %5x %9s\n', i, a, a, dec2bin(a,8));
a = a + 1;    i = i +1;
fprintf('%4d %4d %5x %9s\n', i, a, a, dec2bin(a,8));
a = a + 1;    i = i +1;
fprintf('%4d %4d %5x %9s\n', i, a, a, dec2bin(a,8));
a = a + 200;  i = i + 200;
fprintf('%4d %4d %5x %9s\n', i, a, a, dec2bin(a,8));
a = a + 50;   i = i + 50;
fprintf('%4d %4d %5x %9s\n', i, a, a, dec2bin(a,8));
a = a + 1;    i = i +1;
fprintf('%4d %4d %5x %9s\n', i, a, a, dec2bin(a,8));
a = a + 1;    i = i +1;
fprintf('%4d %4d %5x %9s\n', i, a, a, dec2bin(a,8));
a = a + 1;    i = i +1;
fprintf('%4d %4d %5x %9s\n', i, a, a, dec2bin(a,8));


% the value stored in the vairable a never goes past 255

% if this were a clock timer counting time,
%   whatever algorithm using it would think
%   that time is standing still

% remember: EVERY variable stored in a computer
%           using a finite number of bits
%           has a maximum representable value


