Being Brave

It felt better to put the guess limit above everything instead of right over the loop,
it looked ugly being above it.

Can’t fault you for experimenting but a couple reasons I suggest not doing this. First it’s now a global variable.

Secondly, it’s use is for the loop in this case so it’s better to group it there rather than where it can get lost, so better to have it where it’s used so you’re not searching for it if it needs changing… That’s just my opinion.

1 Like

That makes sense to me, I’ll move it down.
Thanks for the feedback!

Experimenting is the secret you doing great.

I agree the use of globals is evil but it does not really matter for small code like this. There is very low chance to to mix up your global names.

Technically speaking the name of the variable is not good, “limit” is too short and does not say much about the variable

limit to what ?

guessLimit would be more approriate. Developing the habit of accurate naming is far, far , far more important that developing the habit of not using global variables.

1 Like

Fantastic, Thank You!