cwchen icon

[Perl 6] Creating a subroutine with named parameters.

cwchen | PRO | 11/16/17 02:58:14 AM UTC | 0 ⭐ | 8542 👁️ | Never ⏰ | []
Perl 6 |

0 B

|

None

|

0 👍

/

0 👎

sub greet(:msg($g) = "Hello", :name($n) = "World") {
    "$g $n".say;
}
 
greet();
greet(:msg("Goodbye"));
greet(:name("Michael"));
greet(:name("Jenny"), :msg("Hi"));

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎