[erlang-questions] Can not understand the example.

Richard Carlsson richardc@REDACTED
Fri Jan 19 16:58:53 CET 2007


LUKE wrote:
> -module(tut1).
> -export([fac/1]).
> 
> fac(1) ->
>     1;
> fac(N) ->
>     N * fac(N - 1).
> ==================================
> How can i know the function will STOP at N=1?

The clauses are always tested in top-down order.

    /Richard




More information about the erlang-questions mailing list