python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
Why can't return be expressed in one line when using a Switch Expression?
while (true) {
console.mainMenu();
String inputCommand = console.input();
switch(inputCommand) {
case "exit" -> return;
case "create" -> {
...
yongc
Votes: 0
Answers: 1
C# Pattern match arrays
var x = new int[] { 1, 2 };
var y = x switch {
{ 1, 2 } => "yea",
_ => "nay"
};
fails to compile.
How can I pattern-match arrays?
theonlygusti
Votes: 0
Answers: 1