|

|

Я, по всей видимости, что-то упустил в синтаксисе. Вот я сделал тестовую программку: -module(test).
-export([test_func/0]).
-export([test_recursion/2]).
test_func() ->
test_recursion(1, 6).
test_recursion(X, N) ->
if
N > 0 ->
io:format("cycle! ~w ~n", [N]),
test_recursion(X,N-1)
end.
И вот что получаю: [petro@Sulaco erlang]$ erl
Erlang (BEAM) emulator version 5.5 [source] [async-threads:0] [hipe]
Eshell V5.5 (abort with ^G)
1> c(test).
{ok,test}
2> test:test_func().
cycle! 6
cycle! 5
cycle! 4
cycle! 3
cycle! 2
cycle! 1
=ERROR REPORT==== 21-Oct-2006::13:40:58 ===
Error in process <0.32.0> with exit value: {if_clause,[{test,test_recursion,2},{shell,exprs,6},{shell,eval_loop,3}]}
** exited: {if_clause,[{test,test_recursion,2},
{shell,exprs,6},
{shell,eval_loop,3}]} **
3>
А что не так у меня с if-выражением?
(Читать комментарии) Добавить комментарий:
|
|