Course of Raku / Advanced / More about built-in types / Native types 🆕 / Sized types and overflow
Quiz — Overflow
What does the following program print?
my int8 $i = -128;
$i--;
say $i;| 1 | 127 |
| 0 | -129 |
| 0 | -128 |
| 0 | 0 |
An int8 holds values from -128 to
127. Wrapping happens at the bottom edge too: decrementing
the smallest value cannot give -129, so it folds around to
the largest value, 127.