loops - How to set a base case in Erlang -


i trying set base case in erlang recursive step, however, whenever do, end warning variable new_array unused. curious how go setting base case function, seems when set mine defaults running base case instead recursing first.

% base case function(list, array, 0) ->     print_board(array);  function(list, array, size) ->     % stuff here     new_array = array,     function(list, array, size-1). 

thanks in advance help!

erlang checking if declare variable not use it. interesting warning must analyzed, because points issue in program.

in case of first clause, detect base case of recursion because size 0, , in case wants return variable array. first parameter of function useless in case. indicate erlang, can name variable _ or _list.

% base case function(_list, array, 0) ->     print_board(array);  function(list, array, size) ->     % stuff here     new_array = array, %% compiler complain because new_array unused     function(list, array, size-1). 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -