When you need to add a new feature to a program that's similar to some other code in the program, you might be tempted to just copy and paste the code.
In practice, that's actually a pretty bad idea, because it can lead to code bloat. Code bloat means that you have more code in your program than you actually need. Your programs will get longer, and they'll get a lot harder to maintain.
Here's the printout of the tic-tac-toe game. If you really want me to change the colors of the crosses, I'll just need to replace the code that displays each of the 9 squares. That's the same code in 9 different places. Oh, and if you want me to change the 0s...
Was this article helpful?