How do computers stay safe from viruses?

Your computer is like a castle full of treasure — your photos, your homework, your messages, all the stuff you care about. And just like a real castle, it needs guards to keep the bad guys out. So how does a computer defend itself against viruses trying to sneak in and cause trouble?
First, there's the gatekeeper: antivirus software. This program is like a bouncer at a club, checking everyone who tries to come in. When you download a file or open an email attachment, the antivirus scans it first. It compares the file against a huge list of known troublemakers — millions of virus "fingerprints" it's memorized. If it recognizes a match, it slams the door: "Nope, you're not getting in."
