I would be interested to know if there are programming languages that have “shorthand constructions of equality” (I just made this term, but not sure how to describe it).
So, instead of the usual:
if (X == 1 || X == 2)
Transcript verification type, for example:
if (X == 1 || 2)
I understand that for this type of design, there are many against. And that I can create functions to do something like that, but I would be wondering if there are languages that allow you to do out of the box.
EDIT
Thanks to Michael for helping me clarify the situation, I like the way Python does it.
I will try and explain better, because looking at my question above, he doesn’t explain very well.
Instead of checking something in the collection or creating a collection in the background.
I am wondering if there are programming languages, when only a left variable is specified once, it will automatically create a left and right one for you.
So, I am writing this:
if (X == 1 || 2 || 3)
Will actually create
if (X == 1 || X == 2 || X == 3)
I understand that this pseudo-syntax is not very useful and that creating a collection is a great way to do this. But wondered if it existed anywhere.
source share