Course of Raku / Advanced / Subroutines / More on MAIN subroutines / Exercises
A command-line flag
Problem
A Bool named parameter of MAIN turns into
an on/off flag: writing --flag sets it to
True, and leaving it out keeps its default. Write a program
whose MAIN takes Bool :$shout = False and
prints HELLO when the flag is set, or hello
otherwise.
Example
$ raku boolean-flag.raku
hello
$ raku boolean-flag.raku --shout
HELLOSolution
Course navigation
← More on MAIN subroutines | Solution: A command-line flag →