Slightly different method S02_Simplifying with functions

Hi @Neil_Fehr, that’s a very nice way to make your functions. Can I just give you some insights?

PrintGuess method

I see that you use two methods, one to GetGuess() and the other to PrintGuess(). But can you agree with me that the function of this method PrintGuess() is responsible only to PRINT right? So we can change the return type of this method PrintGuess() from string to void and eliminate the Guess variable of the return Guess line.
With this we can make this method exemplify better your function, when you define a return type this method need to return that type, since this method is only printing on the screen that’s no need for the return type, so we can make this method have no return type or a void method.

My explanation make some sense to you? I hope it does bro. I really want to make people understand that when you define a responsibility to a method, only then you will define what type will come back from it, in this case (PrintGuess()) don’t need to return nothing, its function is to print the Guess, only this and nothing else.

Thank you for the suggestion! I actually changed it to void afterwards, just forgot to reply to your comment.

Privacy & Terms