Investing in stocks can be risky, especially if you don't know what you're doing or why you're doing it.

Shares of stock are appraised based on the value of the companies that issued them. If you buy stock in the Whoa Nellie Brake Co. (ticker: HALTT) and it declares bankruptcy, you're probably going to lose money. Most well-known, growing companies don't suddenly go out of business, though. Think of Coca-Cola (NYSE:KO), IBM (NYSE:IBM), ExxonMobil (NYSE:XOM), Wal-Mart (NYSE:WMT), and the like. Look at a graph of the stock market average over many years and you'll see that it's a zigzag line. The zigging and zagging is volatility. But step back and look at the graph and you'll see that the jagged line slopes upward over the long haul. Despite the risk, it gradually gains in value.

You can probably afford to take on some risk by investing in stocks -- as long as the money invested won't be withdrawn within the next five or more years (ideally, and to be more conservative, 10 years or longer). If you'll need the money you're investing for college or a house down payment in two years, stocks aren't a good idea -- the market could drop in the short term. But, if you're investing for the long term, you can patiently ride out downturns. Short-term investors should stick to safer plays, such as money market funds.

Even if you're nearing retirement, odds are that you won't be tapping most of your nest egg for at least five years. So, much of it -- the long-term portion -- can still remain in stocks. Don't assume that just because you're in or near retirement that you need to completely withdraw from the stock market. (The Motley Fool's Money After 40 addresses retirement investing.)

Investing in stocks is certainly not risk-free, but it can be riskier to just conservatively park all your money in an ultra-safe spot such as a money market fund or your safe in the basement. Socked away like that, it can actually lose value over time, thanks to our old friend inflation. The more you learn, the more you can manage risk. For example, know that you needn't spend time focusing on individual stocks if you're not so inclined -- the best investment for most folks is an index fund.

If you've got short-term money to invest, learn how to make the most of it in our Savings Center (which offers Fool s some special deals on interest rates). For investing in stocks and mutual funds, learn all about brokerages and find one that's right for you in our Broker Center.