+ 1
Hi! I have an issue with this rather basic code. It runs properly in SoloLearn but not in VS?🤔🤓
9 Réponses
+ 2
Not sure what was wrong in VS,
I posted your original code in VS and it works as it should.
I suggest you to delete this question and please don't use goto.
I didn't see goto in any of c# projects I was working on
https://stackoverflow.com/questions/3517726/what-is-wrong-with-using-goto
+ 1
I think the problem is with the logic. And using go to statements should be avoided as possible.could you please try the following code?
https://code.sololearn.com/cAP6352CPtQX/?ref=app
0
For the "yellow" section, would it work if you replace the
`goto case "red";`
With this one
`Console.WriteLine("Driver has to slow down!");` ?
As follows:
case"yellow":
Console.WriteLine("Driver has to slow down!");
0
No. To be honest, whatever colour I give as an aswer, the program returns "Driver can drive!". However in SoloLearn app it works perfectly with all the colours.
0
Can you test with another code? make switch block and use string for the cases, I'm just curious whether this issue only affects one file.
0
It seema that I'm doing something fundamentally wrong. I changed the code and it still starts runing the question about the light. I will try once more.n
0
Well, how did it work? already solved I guess?
0
I had to postponed it for today( it's 7am for me at the moment. ) will let you know for sure. I'm kinda curious if anyone has had the similar moment, when the code is running in SL app but the exact code is not running on VS...
0
Okay we'll look forward to others' opinions here 👍