Noob - Getting Started Infinte Loop?
Robert Virding
robert.virding@REDACTED
Thu Aug 31 22:10:30 CEST 2006
Håkan Stenholm wrote:
> foo(_V) -> ok; % variable V is unused, renamed to _V to inidicate that
> it's not used in this clause
> foo(V) -> ....
>
> Note that _V is still a valid variablename, so the code below is valid:
>
> foo(_V) ->
> _V * 2.
>
> a call to foo(42) would yield 84 in this case.
>
>
> But you should never use _ in variable names in this way (instead remove
> the _ if the V is to be used).
Actually this is simple way to get rid of the annoying whining by the
compiler, just prepend every variable with _ and it keeps quiet. :-)
Seriously I would prefer the default to be to keep quiet.
Robert
More information about the erlang-questions
mailing list