Course of Raku / Advanced / More about built-in types / Native types 🆕 / Exercises

Wrapping around

Problem

A uint8 wraps around in both directions, and not only when you step over the edge by one. Demonstrate this:

  1. Take a uint8 holding 250, add 10 to it, and print the result.
  2. Take another uint8 holding 0, subtract one (decrement it), and print the result.

Example

The program prints:

4
255

Solution

See the solution

Course navigation

Solution: The native default   |   Solution: Wrapping around