Last active
February 24, 2017 17:54
-
-
Save muhammednagy/578734582b02cc222104a0213cd7772a to your computer and use it in GitHub Desktop.
variables and patterns in erlang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 🌈