Created
March 17, 2020 14:12
-
-
Save jonathanstowe/bdbe25ecb6547e65a4d3bef4b48a7e3a to your computer and use it in GitHub Desktop.
Recursive thing in Raku
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired by https://dev.to/harleypadua/recursion-recursion-recursion-1501 | |
multi shoot-gun(Str $sound, Int $num where * > 0 --> Str ) { | |
return $sound ~ ' ' ~ shoot-gun($sound, $num - 1); | |
} | |
multi shoot-gun($, 0 --> '') { | |
} | |
say shoot-gun('bang', 5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment