edlang/lib/edlang_driver/tests/programs/factorial.ed

14 lines
194 B
Rust
Raw Normal View History

2024-02-14 10:21:33 +00:00
2024-03-13 11:24:40 +00:00
pub fn main() -> i32 {
let b: i32 = factorial(4);
return b;
}
fn factorial(n: i32) -> i32 {
if n == 1 {
return n;
} else {
return n * factorial(n - 1);
2024-02-14 10:21:33 +00:00
}
}