Hi All, I am reading up on subroutines over at: https://en.wikibooks.org/wiki/Perl_6_Programming/Subroutines The above states: In a subroutine declaration, named parameters must come after all required and optional positional parameters. Named parameters are treated as optional by default unless they are followed by a ! .Actually, you can put a ! after required
positional parameters as well, but that's the default. sub mySub(
:$name!, # Required
:$type, # Optional
:$method? # Still optional
)
Is their example a boo-boo?
:$type, # Optional
How is this "optional" when "!" is the default?
What am I missing?
Many thanks,
-T
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I am Windows I am the Blue Screen of Death No one hears your screams ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
- Subroutine question ToddAndMargo
- Re: Subroutine question Brandon Allbery
- Re: Subroutine question ToddAndMargo
- Re: Subroutine question Brandon Allbery