Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Bitches don't know about my Erlang

Name: Anonymous 2008-01-13 22:00

-module(mathStuff).
-export([factorial/1, area/1]).

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

    area({square, Side}) ->
        Side * Side;
    area({circle, Radius}) ->
        3 * Radius * Radius;
    area({triangle, A, B, C}) ->
        S = (A + B + C)/2,
        math:sqrt(S*(S-A)*(S-B)*(S-C));
    area(Other) ->
        {invalid_object, Other}.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List