My IsLowercase() Method - slight variation

My method for this function. On the basis of islower() being suggested, I wanted to dig around a bit and understand everything as best I could. This led me to the range of case functions, including isupper(), toupper(), and the tolower() function previously used. Rather than asserting the negative (!islower()), I just went with a check to see if anything in the range was uppercase and if so returned false.

Nothing fancy here, it just represents a bit of added effort.

https://gist.github.com/92408512049/649df2dc4fe8ac82eeec8b5d1cf0d2b9

A note - if Guess is 1 letter then this function will return true regardless of the letter’s case. And if it is empty I think it should return false instead of true :slight_smile:

Yes, it returns true regardless of case if Guess is 1 letter, because it then passes that entry through to the CheckGuessValidity() error handling further on which reminds the player to enter an appropriate length isogram :slight_smile:

I meant it should not have been the case. :slight_smile: Of course it may work in your specific code and that’s fine but in general each function should do what their name suggests. https://en.wikipedia.org/wiki/Cohesion_(computer_science)
Anyways, good job trying out new things

Privacy & Terms