© Karl Beecher 2018
Karl BeecherBad Programming Practices 101https://doi.org/10.1007/978-1-4842-3411-2_4

4. Conditionals

Karl Beecher1 
(1)
Berlin, Germany
 

Objectives

In this chapter, you’ll learn:
  • How to make poorly structured and incomplete conditionals

  • How to write gnarled and error-prone expressions

  • What nesting is and how you can abuse it to write complicated code

Prerequisites

Before reading this chapter, make sure you’re familiar with:
  • For-each loops

  • Basic String methods in Java, particularly equals, substring, length, and charAt

  • The basic idea behind reading files in Java

  • Logical operators (&&, || and !)

Introduction

Conditionals (like if statements and select statements) allow the computer to choose automatically between different possibilities. ...

Get Bad Programming Practices 101: Become a Better Coder by Learning How (Not) to Program 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.