Alternative Ternary Expression
Switch branches/tags
Nothing to show
Clone or download
Latest commit b20b476 Apr 19, 2018
Failed to load latest commit information.
lib/Slang Removed dependancies on nqp, prettied up a bit Apr 19, 2018
t Added META file test Apr 19, 2018
.gitignore Kickoff Apr 12, 2018
.travis.yml Kickoff Apr 12, 2018
LICENSE Kickoff Apr 12, 2018
META6.json Added tags to META6.json Apr 19, 2018 Doco update Apr 19, 2018


Slang::AltTernary - an alternative (additional) Perl6 ternary statement.


use Slang::AltTernary;

^10.pick < 5 ?⁈
    Yes say "Heads"
    No  say "Tails";


Slang::AltTernary is a toy for learning about modifying perl6 parsing with slangs.

It adds a new infix operator, ?⁈, (that's a '?' followed by U+2048) which functions in much the same way as perl6's ternary operator 'infix::<?? !!>'.

The difference is instead of seperating the truthful branch from the falsey branch with '!!', AltTernary preceedes the truthful branch with 'Yes' and the falsey branch with 'No'.

It's not intended that this module be used for anything other than exploring the use of slangs - use in any real code is discouraged. You've been warned.


Martin Ryan


Copyright 2018 Martin Ryan

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.