Problem with return guess;

Hi,

I’ve been following the instructions but I have issues when I try to return the guess after I leave the loop.
As you can see from the screenshots I no longer get the number of bulls and cows and get no increase in the number of tries even if I am entering a correct isogram.
I fould this error after I completed the whole lesson 42 and then started reverting back step by step. Currently if I leave the Ftext Guess = “”; before the loop and the return Guess; inside the loop it’s ok, but as soon as I move the return Guess; the problem appears.

Currently I can leave the return Guess; inside the loop and continue as the game runs without errors.


Thanks!
Yordan

It looks like your status code is never getting set to OK. So you never get out of the loop so in the switch statement just goes to the default case. The problem should be in your CheckGuessValidity function somewhere

Thank you so much - I was missing “return” in my CheckGuessValidity function.
Now it works fine. :slight_smile:

Your welcome. Keep in mind the when using a while loop it will continue to cycle until that condition is no longer met. Also keep in mind that the breaks in a switch statement only gets the code out of the switch statement block and not a loop if is in one.

Privacy & Terms