Advertisement
ivandrofly

Boolean variable name suggestion

Aug 4th, 2023
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. For a boolean variable, the name should usually be a predicate, or a statement that may be true or false. It's a good practice to include a verb in your variable name which suggests the state or condition the boolean is representing. Here are some suggestions, depending on the usage:
  2.  
  3. isConnected
  4. hasItems
  5. canSave
  6. shouldDisplay
  7.  
  8. Remember, choosing a good and meaningful name for variables is very important as it makes your code easier to understand and maintain.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement