I've tried in Rust, and it requires a return definition, as do most mainstream functional languages.
Also, mainstream functional languages aren't truly mainstream: I'd struggle to find devs who could help me in consulting gigs.
Also, mainstream functional languages aren't truly mainstream: I'd struggle to find devs who could help me in consulting gigs.
let rec factorial n =
if n = 0 || n = 1 then 1
else n * factorial (n - 1)
F# factorial n =
if n < 2
then 1
else n * factorial (n - 1)
I think the OCaml version will look almost exactly like the F# one.