Erlang Review

2 years ago
20

Erlang is a strange programming language. Interesting concepts though.

I said that I would review the factor() function, but I didn't.

Here is the function definitions:

factor(0) -> 1;
factor(N) -> N * factor(N-1).

If factor() is run using the argument of 0, then 1 is returned. If factor() is run using any other number, then "tail recursion" is used. The tail end of the function recurses the factor() function using N-1, and multiplies that result by N. And repeats, until 0 is reached.

For IT, Software, & Data Privacy Consulting, please visit:

https://superserverhero.com

Loading comments...