Of course, I could only guess if there’s a comma.
Of course I could only guess if there’s a comma!
I’ve added an exclamation mark to emphasise the difference although you don’t necessarily need it. The first can be commonly found when musing, and demonstrates a side thought or an extra consideration. It’s found when you’re discussing issues or considering pros and cons. ‘Of course’ is used to break up this point from the last few. The second is more like ‘I told you so’ or ‘what did you expect’, an exclamatory phrase which is more commonly found in dialogue.
It’s not just ‘of course’ it applies to. It applied to ‘so’ and ‘sorry’ and many other similar sentence starters. If you’re unsure about a comma, just think about how it’s said.