The above solution will also work well for multi html lines or chunks. You could alternatively create a snippet that will show chunk A or chunk B depending on if the user is logged in or not.
Ah, true. I just need to put in the chunk placeholder into the else statement? Sounds quite logical. But multiple html lines (with sections, divs, classes, etc) are not shown with syntax highlights (with extra: ace), when placed into the else statement. So chunks would be the better choice, I guess.
You might look at the
Personalize snippet, which shows different chunks to logged-in and not-logged-in users.