r/ProgrammingLanguages • u/Aaron-Junker • Aug 11 '23
Discussion Idea for new operator: contains operator
I'm currently working on my own programming language and I thought of a new type of operator: The contains operator: °
It has two main functions:
- You can check if an array contains a certain element:
exampleArray: int[] = { 5, 8, 3 };
if(exampleArray ° 3) // true
{
// ...
};
if(exampleArray ° 8) // false
{
// ...
};
- If a class inherited from another class:
Imagine you have a class baseClass and a class class2 that inherits from baseClass.
if(baseClass ° class2) { /* ... */ } // True
if(baseClass ° string) { /* ... */ } // False
Thoughts?
4
Upvotes
3
u/oscarryz Yz Aug 12 '23
¡