Sunday, May 4, 2014

Factorial function implementation in Erlang



-module(factorial). %%This is the name of the module. File should be saved with this
-export([start/1]). %% This is the function that can be accessed from outside

             start(0) -> 0;   %% If the value for start function is 0. this will be executed
             start(Num) -> Num*start(Num-1).  %% Recursiveness is happening

Labels: , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home