Importance of string GetGuess() vs void GetGuess()

During the individual challenge I created the function for the player guess almost identical to the introprint() function and everything worked fine. I’m wondering if there is a specific pitfall of using string vs void.

below is the comparison between the intro code and the player guess code with the void function.

1 Like

If your method is not returning anything use VOID. If it is, use the applicable identifier for the return value.

return nothing

void NoReturnFunction()
{
    //statement
}

return something

string ReturnSomething()
{
     string Something = ""; //doesnt need to be declared in function, just an example
     return Something;
}

hope this helps.

my method is returning what is expected so there really doesn’t seem to be an issue. I was just curious if I just got lucky. But I think your answer explains what I needed, thanks!

Privacy & Terms