Closed arakov closed 7 months ago
Several basic expression patterns can be introduced, allowing to make the operation pattern more readable:
if:is pattern :
import extensions;
class Proxy
{
field _o;
constructor(o)
{
_o := o
}
int cast()
=> _o;
}
guessWho(o)
{
if (o :is int val)
{
console.printLine(o," can be converted to int=", val);
};
}
public program()
{
guessWho(2);
guessWho(new Proxy(2));
}
foreach:in pattern:
foreach(char ch :in "abc")
{
console.printLine(ch)
}
The issue is implemented in ELENA 6.0.7
Is your feature request related to a problem? Please describe. Expression patterns should be introduced