Introduction
The when expression helps you choose what to do based on different values, like a smart traffic controller.
You want to run different code depending on a variable's value.
You need to check multiple conditions without writing many <code>if</code> statements.
You want to replace a long <code>if-else</code> chain with cleaner code.
You want to handle different types or ranges of values easily.