What does the “head mismatch” compiler error mean?

后端 未结 2 1030
遇见更好的自我
遇见更好的自我 2021-02-18 23:40

I tries to write code to print Z character.

zzzzzzz
     z
    z
   z
  z
 z
zzzzzzz

But when I compile this code, it throws

D         


        
2条回答
  •  灰色年华
    2021-02-19 00:13

    the problem is that you have mixed up 2 functions:

    zeez/2 and zeez/3

    If you terminate the zeez/3 function by ending it with a full stop not a semi-colon it should compile:

    zeez(true, M, N) ->
        io:format("~p~n", [zeez(space, N-M)] ), % line 16
        zeez(M rem N =:= 0, M + 1 , N );                      <-- should end with .
    

    The error message means, 'hey I'm in zeez/3 and you have thrown in a 2-arity clause, wtf?'

提交回复
热议问题