mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
v: support dump(expr) (#9160)
This commit is contained in:
parent
747507dd1d
commit
849cde245c
18 changed files with 219 additions and 53 deletions
10
examples/dump_factorial.v
Normal file
10
examples/dump_factorial.v
Normal file
|
@ -0,0 +1,10 @@
|
|||
fn factorial(n u32) u32 {
|
||||
if dump(n <= 1) {
|
||||
return dump(1)
|
||||
}
|
||||
return dump(n * factorial(n - 1))
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println(factorial(5))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue