You have many good answers.
There are many different types of ocean currents, but the one that runs along the shoreline is the most dangerous because it runs along the shoreline.
What you should know is that a current running next to the shoreline can run in very shallow waters, even water that is only 12inches deep, to 10 feet deep and more. When I mean along the shoreline I mean two inches to two feet off the shoreline. I live in Hawaii so I know what I am writing about, being a surfer I have entered the water only to be pulled down the beach only a few feet off the dry sand. The worst you can get into is the undertow kind of current, just what it says undertow, that means it has the power to pull you under and drag you along the shoreline and then out to sea. It may drag a few feet to a few thousand feet off and away from shore. If you are ever caught in an undertow, the best thing to do is to relax and float along with it until it releases you or you wait to you know which way the current is pulling you, when you know that then you can swim out of it by swimming across of it not at it but across until you are out and then swim in. Remember, across the current not against it, you will know because as you are swimming across you will still be getting drag along with it, but you will be able to see the edge of the current by the sand or ripples being pulled along with you.
Best thing to do though is to ask the life guard or someone who is on the beach or just look at the water, and you will or should see the current ripping along the shoreline by the sand that is being sucked up in a line and being pulled out to sea.
Good luck and be safe....cya....