Should Boolean Variables Start with Is?

Should Boolean Variables Start with Is?

Boolean variables should be prefixed with 'is'
This is the naming convention for boolean methods and variables used by Sun for the Java core packages.

Do booleans have to start with is?

There is a convention to prefix boolean variables and function names with "is" or "has". ... You know, something like isLoggedIn , hasAccess or things like that.

Is or has in boolean naming?

The usual convention to name methods that return boolean is to prefix verbs such as 'is' or 'has' to the predicate as a question, or use the predicate as an assertion. For example, to check if a user is active, you would say user. isActive() or to check if the user exists, you would say user.

Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.