Files
dotfiles/dot_config/nushell/nu_scripts/modules/recursion/countdown.nu
Cian Hughes 896af887ca Changed . token to _dot
This change allows the dotfiles to work with chezmoi (e.g: on windows)
and improves grepability with neovim/telescope
2024-11-07 13:52:17 +00:00

12 lines
278 B
Nu

# Simple countdown counter from some number n to 0. Returns 0 at end
# Designed to be used with the tramp module to avoid stack overflows via the
# use of the Trampoline method.
def countdown [n: int] -> int {
if $n == 0 {
0
} else {
{|| countdown ($n - 1) }
}
}