Skip to content

Files

Latest commit

 

History

History
31 lines (19 loc) · 750 Bytes

File metadata and controls

31 lines (19 loc) · 750 Bytes

Pattern: Use of poorly named variable

Issue: -

Description

Variables named I, O, and l can be very hard to read. This is because the letter I and the letter l are easily confused, and the letter O and the number 0 can be easily confused.

Change the names of these variables to something more descriptive.

Example of incorrect code:

The code in this example could be misinterpreted to be 0 * 1.08 (zero times one-point-eight).

O = 100.0
total = O * 1.08

Example of correct code:

This example clarifies that we're multiplying an order variable by another number.

order = 100.0
total = order * 1.08

Further Reading