-module(test). -record(r,{a,b}). -compile(export_all). -scan(indentation). f(X) -> X+2 g(X) -> X+4 . % dot can either be 'outdented' or terminating last line g1(X) -> X+4. h(X) -> Y = case X of a -> {a} b -> {b} end % end is optional Y h1(X) -> Y = case X of a -> {a} b -> {b} Y h2(X) -> case X of a -> 1 b -> 2 h3(X) -> case X of a -> 1; % must use semicolon here b -> 2 i(a) -> a i(b) -> b j(A,B) -> {A B} j1(A,B,C) -> {A B % indents must be greater than 1; else they count as aligned C} k() -> S = "a string " "spanning multiple " "lines" {S} l0() -> fun(1) -> 1; (2) -> 2 end. l1() -> fun (1) -> 1 (2) -> 2 %%% This, alas, doesn't work %%% %%% l2() -> %%% fun(1) -> %%% 1; %%% (2) -> %%% 2 %%% end m() -> #r{a = 1, b = 2}. m1() -> R = #r{a = 1} R#r.a %%% indentation syntax works poorly for record assignment. %%% Both commas are needed m2() -> R = #r{a = 1, b = 2}, R test() -> 2 = f(0), 4 = f(2), 4 = g(0), 4 = g1(0), 8 = g(4), {a} = h(a), {b} = h(b), {a} = h1(a), {b} = h1(b), 1 = h2(a), 2 = h2(b), 1 = h3(a), 2 = h3(b), a = i(a), b = i(b), {a,b} = j(a,b), {a,b,c} = j1(a,b,c), {"a string spanning multiple lines"} = k(), F0 = l0(), 1 = F0(1), 2 = F0(2), F1 = l1(), 1 = F1(1), 2 = F1(2), {r,1,2} = m(), 1 = m1(), ok.