Created
April 1, 2015 07:38
-
-
Save qrilka/cf03dd505ac8e9d30c44 to your computer and use it in GitHub Desktop.
if vs case
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 'test' ['a'/1, | |
'b'/1, | |
'c'/1, | |
'module_info'/0, | |
'module_info'/1] | |
attributes [] | |
'a'/1 = | |
%% Line 4 | |
fun (_cor0) -> | |
%% Line 5 | |
case <> of | |
<> | |
when call 'erlang':'>' | |
(_cor0, | |
5) -> | |
%% Line 6 | |
'greater' | |
%% Line 7 | |
<> when 'true' -> | |
%% Line 8 | |
'not_greater' | |
end | |
'b'/1 = | |
%% Line 11 | |
fun (_cor0) -> | |
%% Line 12 | |
case <> of | |
%% Line 13 | |
<> | |
when call 'erlang':'>' | |
(_cor0, | |
5) -> | |
%% Line 14 | |
'greater' | |
%% Line 15 | |
<> when 'true' -> | |
%% Line 16 | |
'not_greater' | |
end | |
'c'/1 = | |
%% Line 19 | |
fun (_cor0) -> | |
case _cor0 of | |
<X> | |
when call 'erlang':'>' | |
(_cor0, | |
5) -> | |
%% Line 20 | |
'greater' | |
%% Line 21 | |
<_cor2> when 'true' -> | |
%% Line 22 | |
'not_greater' | |
end | |
'module_info'/0 = | |
fun () -> | |
call 'erlang':'get_module_info' | |
('test') | |
'module_info'/1 = | |
fun (_cor0) -> | |
call 'erlang':'get_module_info' | |
('test', _cor0) | |
end |
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(test). | |
-compile(export_all). | |
a(X) -> | |
if X > 5 -> | |
greater; | |
true -> | |
not_greater | |
end. | |
b(X) -> | |
case X > 5 of | |
true -> | |
greater; | |
false -> | |
not_greater | |
end. | |
c(X) when X > 5 -> | |
greater; | |
c(_) -> | |
not_greater. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment