Search code examples
raku

Raku bug or feature: empty range is True


% raku
Welcome to Rakudo™ v2023.08.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2023.08.

To exit type 'exit' or '^D'
[0] > say so 1..0;
True

It would be useful if an empty Range would be False, but any range is True. Is this a bug or a feature?


Solution

  • It turns out that this is indeed a bug, and it is fixed in the future 6.e version of Raku.

    % raku
    Welcome to Rakudo™ v2023.08.
    Implementing the Raku® Programming Language v6.d.
    Built on MoarVM version 2023.08.
    
    To exit type 'exit' or '^D'
    [0] > use v6.e.PREVIEW;
    Nil
    [1] > say so 1..0;
    False