fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 31: Recursive factorial (simple)
Idiom # 31: Recursive factorial (simple)
See
programming-idioms.org
:
Code
f(n i32) => if n = 0 1 else n * f n-1 /* or */ f(n i32) => n = 0 ? 1 : n * f n-1 // NYI
What are effects?
Running Example
ex31 is f(n i32) => if n = 0 1 else n * f n-1 1..10 ! n -> say "f $n is {f n}"
What are effects?
last changed: 2024-07-01
next: Idiom # 32: Integer exponentiation by squaring