If you are caught out in the rain and your camera (or any other electronic gadget, such as a mobile phone or MP3 player) does get wet, it doesn't necessarily mean that it's ruined beyond repair. As long as you act quickly and do the right things you can most likely save it. The first thing to remember is not to switch the camera on until it is completely dry, as this may cause short-circuits which will most likely fry the delicate electronics inside. The best course of action is to remove the batteries at once, since the batteries themselves can malfunction if wet. If the lens has got wet, remove the battery without first switching off the camera. This will prevent the lens from retracting and carrying water inside the camera body. It will also make it much easier to dry the lens.
Carefully dry any water from the outside of the camera using an absorbent kitchen towel, but do not use any type of paper towel or tissue on the glass parts of the lens. Even the softest paper contains tiny abrasive particles which are capable of scratching your lens.
Carefully clean any water from the lens and other glass parts, ideally using a proper microfibre lens cloth, paying close attention to the edge of the lens where joins to the lens barrel. If water gets inside the lens barrel and between the elements, it can cause marks on the lens coating and even lead to the growth of fungal blooms on the surface of the lens. If this happens you will need to have your camera professionally serviced. If you don't have a microfibre lens cloth, any clean soft lint-free cloth can be used, such as the type usually supplied with a new pair of spectacles.
Once you've dried the outside of your camera, place it somewhere warm and dry for at least 24 hours. Don't overheat it by putting it in the oven or on top of a radiator, but a warm airing cupboard is fine. You can help speed the drying process by putting the camera in a small cardboard box with a couple of those moisture-absorbent packs of silica gel ("Do Not Eat") that come packed with new electronic equipment. If you don't have any of these, a hand full of rice grains will also help.
Once you are confident that your camera is completely dry, replace the battery and switch it on. If it doesn't start up normally straight away, turn it off again, remove the battery and consult your dealer or the manufacturer's technical help line, since it will need professional repair. Note however that flash memory cards (SD, CompactFlash, Memory Stick etc.) are virtually unaffected by water, and have even been reported to survive a trip through a washing machine. Dry them off thoroughly as described above before use, but you will almost certainly find that any pictures saved on the memory card are safe and sound, even if the camera is a write-off.