GettyImages-543294374
Traders work on the floor of the New York Stock Exchange (NYSE) on June 27, 2016 in New York City. Spencer Platt/Getty Images

Global stock markets Friday did not reacted kindly to the vote by the United Kingdom to part ways officially with the European Union.

Whether you've been closely following the vote or are just getting up to speed, you're probably wondering what to do with your 401(k) or IRA now that U.S. and global stocks are declining. The answer depends, at least somewhat, on your age.

You're in Your 20s or 30s. Now is a great time to invest more for retirement. You have many decades to go before you are likely to retire, giving you plenty of time to recover from any short-term or midterm losses. Despite occasional dips, the stock market trends upward, averaging about 8 percent in annual gains over time. Very few years see a clean 8 percent gain, however. Some years are flat, and some years have big swings in either direction. Still, if you're saving for a goal like retirement, investing in the stock market is the best way to put your money to work for you.

You don't have to be an investing expert to get involved. Choosing a target date retirement fund is a perfectly good option for investors. Your 401k is sure to have a few such choices, so look for the target date that is nearest to the year you will be in your late 60s. For example, someone who is 30 today would want to choose a target date fund associated with the year 2050.

You're in Your 40s or Early 50s. Get serious about your retirement portfolio. You're in your peak earning years, and if you're behind in your retirement savings then it's time catch up. Don't try to time the market, and don't let fear drive your investing choices. Hopefully you have an investment strategy for your retirement accounts, and now is the time to stay the course. If you don't have course, this is a good time to get one.

You've been around the block when it comes to investing, so you know periodic declines are part of the game. The future of Brexit has introduced a lot of uncertainty into the global economy and, by extension, the stock markets, and the markets hate surprises. Put your savings on autopilot and stay focused on your long-term goals.

You're in Your Late 50s or 60s. Re-evaluate your current investments. The closer you are to retirement, the more unsettling market turmoil can be. Don't rush to make quick changes today, but do take some time in the near future to assess your current investment choices and make sure they're in line with your age and goals.

In addition to your retirement portfolio, it's worth taking a hard look at your current employment plans. If you plan to continue working at your current job for the foreseeable future, then make sure your company is solid and can survive a possible downturn. Or if you're interested in an encore career, start the process now. Making a career transition before retirement can be a good way to give yourself a few more years of saving and investing, but it can take 18 months or longer to make a switch. No amount of preplanning is too much.

After the current acute market reaction settles down, the Brexit vote is likely to have an ongoing effect on the global economy and global markets. No matter what happens or what the markets do, remember that investing is never an emergency. Move slowly and thoughtfully, while keeping a clear focus on your personal goals rather than any panic that may arise.