Source: StockMonkeys.com.

Should investors invest their funds in stocks or in bonds? Both asset classes clearly have their advantages and disadvantages, and their performances will differ depending on the prevailing economic environment.

Stocks and bonds are both suitable for investors who want to build a nest egg for retirement, but their suitability and the appropriate allocation in investment portfolios largely depend on the age of the investor.

In order to depict the suitability of stock and bond investments, let's illustrate some fundamentals.

Stocks
Shares, first and foremost, represent ownership stakes in businesses which generally have great earnings prospects when the economy transitions from recession to recovery mode.

In other words, stocks are great investments when GDP grows healthily, interest and inflation rates increase modestly, and economic prospects are perceived as solid.

Stocks appreciate in value as the company rakes in more revenue and earnings. The value of stocks ultimately depends on the residual value of the company after all other stakeholders (creditors, employees, banks) have been paid.

Because stockholders absorb a higher risk than bondholders, investors in stocks generally have a greater return potential than investors who buy the debt of a company.

Bonds
Bonds entitle the holder to receive regular interest payments (called coupon payments) that are paid as a percentage of the face value of the bond.

Bonds are usually expected to do well in a downturn because of the calculation of the bond's value. Generally speaking, when interest rates decrease (which happens in a recession), bond values go up. It is this inverse relationship between price and interest rates that makes bonds attractive.

There are two other implications investors need to know about. First, buying bonds at the beginning of the recession can be lucrative, because investors "lock in" a yield at the time of purchase, oftentimes for many years, even as overall interest rates decline.

This can be a good thing for investors, who not only benefit from a comparatively high yield on the bond, but who could also gain from the price appreciation potential of the bond.

Secondly, bonds generally have a higher default risk during a recession. If the economy contracts and and corrects the excesses of the last expansion period, some businesses fail -- and default on their debt obligations.

Obviously, investors should only choose quality bonds of companies that have a track record of making sure investors are paid the interest owed to them. Large-cap, investment grade-rated companies are usually reliable coupon payers.

Investment horizon
The length of the investment horizon is another important aspect investors need to consider when deciding between stocks and bonds.

Generally speaking, the younger you are the more of your funds you can allocate to equities (especially when you are in your 20s and 30s). Why?

Because you have ample time to recover from any recessions and market downturns and you should be able to do nicely with an investment horizon of 30-50 years.

As you age, it is appropriate to gradually transition your equity-centered portfolio toward bonds. Fixed-income investments like bonds allow you to plan your retirement based on some fairly stable flow of cash; they also provide peace of mind that stock market fluctuations are not affecting your wealth to a high degree.

The Foolish takeaway
Stocks and bonds are both highly interesting, yet succinctly different, asset classes that do well in varying economic environments. Stocks are great investments as the economy is about to leave a recession and bonds should do well as the economy cools off and contracts.

Young people should allocate a larger percentage of their funds to equities, as their long investment horizon enables these investors to bounce back from any short-term market downturns.

Investors in their 50s are advised to swap their funds from equities into bonds in order to make sure that they are less exposed to devastating market fluctuations that could wipe them out just before they retire.