[erlang-questions] Guards syntax for multiple values

Dan Sommers 2QdxY4RzWzUUiLuE@REDACTED
Wed Mar 27 03:40:39 CET 2019


On 3/26/19 8:55 PM, Florent Gallaire wrote:
> Tanks a lot José for your great examples, even if obvious for me some
> people seem to really need them.
> 
>> char_unreserved(Char)
>>     when Char >= ?0, Char =< ?9;
>>          Char >= ?A, Char =< ?Z;
>>          Char >= ?a, Char =< ?z;
>>          is_member("~_-.", Char) ->
>>   true;
>>
> 
> char_unreserved(Char)
>      when is_member("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~_-.")
> ->
> true;

Given the following from section 2.3 of the RFC:

       unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"

I find José's example clearer.



More information about the erlang-questions mailing list