Ridges on Coins

What is the purpose of the ridges on the edges of coins? Without ridges, it is possible to scrape some shavings of metal off coins without being obvious. In the days when coins were made of silver or gold, a person could otherwise have made a good but illegal living from shaving coins and selling the precious metal.

Public domain via Wikimedia Commons