I been messing around with this piece of code for a couple hours and I still don't know what I'm doing wrong i have other functions and this is the only one i been having trouble with.
-module(if_statements).
-export([weather/1]).
weather(TEMP) ->
if
TEMP <= 0 ->
io:fwrite("freezing\\n");
0 < TEMP <= 10 ->
io:fwrite("cold\\n");
10 < TEMP <= 20 ->
io:fwrite("normal\\n");
20 < TEMP <= 30 ->
io:fwrite("hot\\n");
30 < TEMP <= 40 ->
io:fwrite("heated\\n");
40 < TEMP ->
io:fwrite("hirviendo\\n").
true ->
io:fwrite("unknown")
end.
Shell: The shell hasn't been really helpful either
if_statements.erl:6:8: syntax error before: '<='
% 6| TEMP <= 0 ->
% | ^
if_statements.erl:18:8: syntax error before: '->'
% 18| true ->
% | ^
if_statements.erl:2:2: function clima/1 undefined
% 2| -export([weather/1]).
% |