Suggestion: Operator `in` for slices

Dennis dkorpel at gmail.com
Mon Dec 20 10:34:44 UTC 2021


On Sunday, 19 December 2021 at 17:11:23 UTC, Ola Fosheim Grøstad 
wrote:
> But your proposal would kinda work like in Python?
>
> In [3]: 'a' in {'a':1, 'b':2}
> Out[3]: True
> In [4]: 'a' in ['a','b']
> Out[4]: True

In my proposal `'a' in ['a', 'b']` will return `null` because it 
looks for the key 'a', and since the ASCII value of 'a' is `0x61` 
and the array length 2, it will return `null`.


More information about the Digitalmars-d mailing list