Bool, if, switch OMG!

At first I wasn’t sure at all with the bool lines of code. As I’m using words and not numbers to select my levels.

Then he introduced switch OMG :scream:
While I thought I followed the lecture perfectly (before the challenge), my code turned out with bunch of mistakes!!!

I came to realized I had an extra } somewhere. After fixing that, all became clear and working like a charm.

I seriously didn’t understand why the bool came in (maybe I’m just too tired, almost 2am), but now I do think using switch gives a better look the my code.
I’m sharing it just in case it helps someone.

I’m new to coding, too. And if there is one thing I learned, those little {} will kill you if you’re not careful with them. I learned that the hard way.

I used to code 20 years ago (ive come back in the last few months) and the braces were a big problem for me. With the current visual C# editor I find it so helpful if you collapse all the functions etc ie the little + button to the left. Then you can easily look for orphan curly braces }

it used to take me ages in the old days to find extra or missing braces

1 Like

I’m with you on this David_Graf. so much easier with modern IDE’s!

Privacy & Terms