v/examples/dump_factorial.v

11 lines
140 B
V
Raw Normal View History

2021-03-06 18:09:28 +01:00
fn factorial(n u32) u32 {
if dump(n <= 1) {
return dump(1)
}
return dump(n * factorial(n - 1))
}
fn main() {
println(factorial(5))
}