Skip to content

Instantly share code, notes, and snippets.

@muhammednagy
Last active February 24, 2017 17:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muhammednagy/578734582b02cc222104a0213cd7772a to your computer and use it in GitHub Desktop.
Save muhammednagy/578734582b02cc222104a0213cd7772a to your computer and use it in GitHub Desktop.
variables and patterns in erlang
-module(fun).
-export([maxThree/3,howManyEqual/3]).
maxThree(A,B,C) ->
Z = max(A,B),
max(Z,C).
howManyEqual(A,A,_) ->
2;
howManyEqual(_,A,A) ->
2;
howManyEqual(A,_,A) ->
2;
howManyEqual(A,A,A) ->
3;
howManyEqual(_,_,_) ->
0.
@muhammednagy
Copy link
Author

to compile this code you need to install erlang on your machine.
open terminal.
cd to the dir you downloaded the code in
open erl
c(fun).
thee you can try the functions
it is based on the legendary matching of erlang 🌈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment