Not all malware is damaging for your computer. The extent to which a malware can damage your computer totally depends on the purpose for which it is designed. While some malwares are designed purely for entertainment purposes, others can be very harmful for your computer. Most malwares will harvest your keystrokes and the data that you search so as to sell them to the bidders.
Viruses, similar to malware, are designed to interfere with your computer’s working and computations for different purposes. The damage caused by viruses also depends on its design. Same is the case with Trojans. The best way to prevent yourself from these damaging codes, is to use an antivirus software.