Ask coding questions

← Back to all posts
Why won't this work?
Bunnytoes (157)

I don't know why this won't work can you tell me what's wrong?

Answered by Coder100 (18208) [earned 5 cycles]
View Answer
Coder100 (18208)

the default must be last, like this:

    switch (arrow) {
 case Convert.ToString(ConsoleKey.LeftArrow):
 Console.WriteLine("You chose left");

Console.WriteLine("I said do an arrow key");

btw you don't need to specify the namespace, you already imported it!

Bunnytoes (157)

@Coder100 oh ok, but I have done it before with the default after the switch and thanks!I added this and it still has an error 9,7 a constant value is expected

Coder100 (18208)

you forgot that left arrow is most commonly associated with get key not get line. Who wants to press the left arrow and then press enter?

Coder100 (18208)

btw want an explanation on why that error exists @Bunnytoes

Bunnytoes (157)

@Coder100 sorry for pinging you on my tutoiral but I wanted to give credit