A bug is a piece of code that is developed to interrupt the regular functioning of a computer system. Viruses can spread out quickly and cause substantial damage to both private computer systems and networks. Some viruses are safe, while others can erase files, corrupt information, and even damage hardware.