Course of Raku / Advanced / Containers / Contexts 🆕 / Exercises / A Boolean check

Solution: A Boolean check

Here is a possible solution to the task.

Code

my @empty;
say ?@empty;

🦋 You can find the source code in the file boolean-check.raku.

Output

False

Comments

  1. The ? prefix forces Boolean context.

  2. An empty array is false, which is exactly what if @array relies on.

Course navigation

A Boolean check   |   Item or list