
7 Jul
2015
7 Jul
'15
10:06 a.m.
Thank you Brandon. Well in Erlang you can mix and match patterns with outer scope variables. It is very handy, I agree. Here is an example. You can try this code in browser here: http://tryerl.seriyps.ru/#id=e3f2 % -*- coding: utf8 -*- -module(main). -export([main/0]). main() -> check(2), check({other,4}). check(X)-> A1 = 1, A2 = 2, case X of A1 -> io:format("A1~n"); A2 -> io:format("A2~n"); {other,X1} -> io:format("~p~n",[X1]) end.