Software consists mostly of testing data and determining whether certain conditions are true or false. Every program makes thousands of these decisions. Since boolean logic is so vital to an application, it’s important to take care when programming them. A single boolean statement is easy to understand, but complex logic with two or more boolean statements can be hard to understand, making it hard to maintain and the source of bugs. Even small improvements to boolean logic can help prevent misunderstandings. In this chapter, we will discuss different techniques you can use. Each method has pros and cons. ...
Get Clean Ruby: A Guide to Crafting Better Code for Rubyists now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.