Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanstowe/bdbe25ecb6547e65a4d3bef4b48a7e3a to your computer and use it in GitHub Desktop.
Save jonathanstowe/bdbe25ecb6547e65a4d3bef4b48a7e3a to your computer and use it in GitHub Desktop.
Recursive thing in Raku
# 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