Suggestion: Operator `in` for slices

Ola Fosheim Grøstad ola.fosheim.grostad at
Sun Dec 19 17:11:23 UTC 2021

On Saturday, 18 December 2021 at 20:46:06 UTC, Dennis wrote:
> I wouldn't mind giving `in` this meaning so you can do easy 
> bounds checks in slices as well, but I think it will be to 
> confusing for newcomers expecting `in` to work like in Python.

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

More information about the Digitalmars-d mailing list