variable '_' is unbound
Raimo Niskanen
raimo@REDACTED
Tue May 28 08:49:09 CEST 2002
You can only have bound variables in a guard, and you can only bind
variables in the argument list of a function definition. (First hunch).
foo(Arg) when bar == Arg -> ok;
foo(<<_:16>> == Arg) -> ok.
or
foo(Arg) when bar == Arg;
binary(Arg), size(Arg) == 2 ->
ok.
or something.
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
Vance Shipley wrote:
>
> What is wrong with this:
>
> foo(Arg) when bar == Arg; <<_:16>> == Arg -> ok.
>
> When I try to compile it I get:
>
> 1> c(t).
> ./t.erl:4: variable '_' is unbound
> error
>
> This is using R8B-1.
>
> -Vance
More information about the erlang-questions
mailing list