as an adverbial phrase, 'of course' is used to indicate that something is expected, obvious, or already known. It can also be used to give permission or to emphasize agreement.
'of course' can be used to express agreement or consent. It can be used to emphasize that what's being referred to is not surprising or is to be expected. When giving permission, 'of course' can be used to indicate that the request is reasonable or not a problem.
'Can I borrow your book?' 'Of course!'
'She's late again.' 'Of course, she always is.'
'I knew he would come to the party; of course, he wouldn't miss it.'
while 'of course' can be used to emphasize agreement, it's important to note the tone of voice. In some contexts, especially if said sarcastically, it can imply the opposite. Avoid overusing 'of course' in formal writing, as it can come across as informal or conversational. Be cautious about using 'of course' in situations where it might sound dismissive or as if you're taking something for granted.