[erlang-questions] literal character syntax
Magnus Henoch
magnus@REDACTED
Wed May 14 16:41:15 CEST 2014
Sean Cribbs <sean@REDACTED> writes:
> They are incredibly useful in pattern-matching simple string arguments. e.g.
>
> case erlang:system_info(version) of
> [$5, $., $1, $0 | _ ] -> ok;
> _ -> fail
> end
In this case, you could in fact write it like this instead:
case erlang:system_info(version) of
"5.10" ++ _ -> ok;
_ -> fail
end
Regards,
Magnus
More information about the erlang-questions
mailing list