- For example, in a word problem a student might name the variable for the speed of a rocket rocketSpeed instead of x or y.
- This will help students write clean and code that is easy for a human reader to follow.
- Explicitly creating a naming convention for booleans will help students recognize booleans in code.
- This also adds a uniform style expectation for your class that will make it easier for you to read student code and for students to read their own code as well as each other’s code.
- Below are examples of good and bad variable names for booleans:
- Good Examples:
- isDone
- keepGoing
- isOpen
- Bad Examples:
- Random Letters: b, x and y
- Not starting the booleans with is: done
- Good Examples: