1 2 3 4 5 6 7 8 9 10 11 12 13 14
| -export([check_num_compute/1]).
check_num_compute(NumeroCompte) when length(NumeroCompte) == 9->
case io_lib:printable_unicode_list(NumeroCompte) of
true -> validate_contents(NumeroCompte);
false -> {error, bad_arg}
end;
check_num_compute(_) ->
io:format("count number incorrect\n").
validate_contents([]) -> io:format("count number coorect\n");
validate_contents([C|Cl]) when C >= $0 ,C =< $9 ->
validate_contents(Cl);
validate_contents(_) ->io:format("count number coorect but it s not only number\n"). % if any character isn't a number than bad_arg, |
Partager