underscore prefixed variables (was: Re: Noob - Getting Started Infinte Loop?)

Fredrik Thulin <>
Thu Aug 31 12:22:41 CEST 2006


On Thursday 31 August 2006 11:19, Bjorn Gustavsson wrote:
> It is sometimes useful to refer to variables with underscores
> in debug code. In the example below, the io:format/2 call can
> be simply uncommented when needed:
>
> foo(V) ->
>         ....
> foo(_V) ->
>    %% io:format("~p\n", [_V]),
>    error.

And if a compiler warning was issued when you had uncommented the debug 
printout, you wouldn't forget to comment it out again when you were 
finished debugging ;)

/Fredrik



More information about the erlang-questions mailing list