Add recursive countdown example in Rust

This commit is contained in:
Alexander Launi
2020-03-21 16:08:56 -04:00
parent d8da439590
commit 858e1e71e7
3 changed files with 31 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
fn countdown(i: u32) {
println!("{}", i);
if i == 0 {
return
}
countdown(i - 1);
}
fn main() {
countdown(5);
}