i’m pulling my hair out trying to compile the code in Crait’s lesson 4, random guessing game.
It keeps telling me it expects a “}” before my else statement but i’ve gone through the whole code and the brackets are correct. This is the else that goes with the second if statement in the image below.
Even though I think i’m correct, I put in in anyway and I get the next error:
which I know is because I put the “}” in where it told me to, but this closed out my first IF statement and it means my later “}” closes out my void loop () before my last else statement.
So what the HECK is going on?!? I can’t seem to do anything that lets it compile without errors and i’ve checked it over and over and the code looks the same as the structure in the tutrorial.
sorry folks! I saw the problem 5 seconds after posts. I had a “;” at the end of my IF statement. D’Oh!
Don’t worry, i solve a ton of problems by writing them out and then going “oh wait duh”
Protip: buy a rubber duck.
In software engineering, rubber duck debugging is a method of debugging code. The name is a reference to a story in the book The Pragmatic Programmer in which a programmer would carry around a rubber duck and debug their code by forcing themselves to explain it, line-by-line, to the duck. Many other terms exist for this technique, often involving different inanimate objects.
Many programmers have had the experience of explaining a problem to someone else, possibly even to someone who knows nothi...
I talk to my cat, he and I have solved MANY problems together