+ 1

Hi! I have an issue with this rather basic code. It runs properly in SoloLearn but not in VS?🤔🤓

https://code.sololearn.com/cR1uuLxijNZS/?ref=app

6th Nov 2019, 7:01 PM
Terje Tõnutare
Terje Tõnutare - avatar
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
8th Nov 2019, 8:34 AM
wave rider
wave rider - avatar
+ 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
7th Nov 2019, 6:30 PM
Sameera Arukwatta
Sameera Arukwatta - avatar
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!");
6th Nov 2019, 7:08 PM
Ipang
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.
6th Nov 2019, 7:11 PM
Terje Tõnutare
Terje Tõnutare - avatar
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.
6th Nov 2019, 7:21 PM
Ipang
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
6th Nov 2019, 7:49 PM
Terje Tõnutare
Terje Tõnutare - avatar
0
Well, how did it work? already solved I guess?
7th Nov 2019, 3:31 AM
Ipang
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...
7th Nov 2019, 5:01 AM
Terje Tõnutare
Terje Tõnutare - avatar
0
Okay we'll look forward to others' opinions here 👍
7th Nov 2019, 5:12 AM
Ipang