The For loop Challenge

Here is my work on the For Loop Challenge in Lesson 22.

Congratulations on solving the challenge!

I would like to point out one thing though. You are using capital letters for all of your variables. That is fine to do, but generally you only capitalize variables that are const or constexpr. This is because they are a constant value and can never change. The capital letters represent that to other programmers and yourself. In the screenshots above, regular variables that can be changed (i.e. not constant) are capital. If this was a complex application and I was someone other than you who needed to edit the code, I would surely get confused.

So for you variables P_GUESS, it would be best to just name it Guess so no one gets confused. The variable NUMBER_OF_TRIES can stay capital letters, but you should add a constexpr before the type(which happens to be int).

Technically you don’t have to listen to me and can continue to use capital letters for everything. But, I promise that you will have problems with that in the future if you continue.

I now hope you understand better when capital letters are used and not used.

P.S.: Sorry if I came off sounding as a douche bag, I am just trying to help some of the beginner programmers understand things better :slight_smile:

1 Like

Thank you for the tip! I edited my code to follow the standard that they were showing.

I appreciate you taking the time to look over my code and reply :slight_smile:

Privacy & Terms