How does the ternary operator work in the wordpress loop post?

The double colon in this case is part of the alternative syntax for control structures.
That’s not the ternary operator.

You could also write instead:

if ( have_posts() )
{
    while( have_posts() )
    {
        the_post();
        the_content();
    }
}

I prefer the second style, most code editors enable automatic folding with it, so I can close parts I don’t need to see.