I think I broke it - Help

HEllo, I tried to do this but something broke. Windows id giving me an error when I run the program, while in the IDE there are no code errors.

Here is the Error:

And here is my code I am doing the challenge. I think it may have something to do with the string GetGuess() function, I am not sure how to handle the string declaration … so I placed it outside, a global? Mainly because I was thinking to call the function 2 times so that we have 2 guesses so if it is in the function it will create a problem no since it repeats? Or will it not since we call functions this time and it is only once in the function?

So tried to put

string Guess = “”;

In to the function and got another error. (same as above). in windows but not in the Error List, it says 0 errors.

Any ideas?

Well, I found the error by watching the solution, i could not figure it out so I advanced to the solution in the video.

I realized that I was returning 0 twice…and not returning the Guess in the GetGuess method.

Now it works fine and it also make logical sense…I understand better the way it works calling the method :slight_smile: Like the flow of execution of the code.

And I tried adding a second time the Method in main and it works too since we only declare the string once in the method we can call the method as many times as we want :slight_smile:

I like it! But now time to bed, 6 AM have not slept yet lol! :slight_smile:

Perhaps more concisely, in your function string GetGuess() you were returning type int, when you wanted a string. :wink:

1 Like

Privacy & Terms