When do you use a comma in a sentence

You use a comma in a sentence in the following situations:

1. To separate items in a series: Example - I bought apples, oranges, and bananas.
2. To separate independent clauses in a compound sentence: Example - I went to the store, and I bought some milk.
3. To set off introductory elements: Example - However, I still found the movie enjoyable.
4. To set off nonessential or parenthetical information: Example - The book, which was written by a famous author, is quite popular.
5. To separate adjectives that modify the same noun: Example - He was wearing a big, red hat.
6. To separate quoted speech from the rest of the sentence: Example - She said, "I will be there by 7 o'clock."

There are additional specific rules for comma usage, but these are some common instances where a comma is used in a sentence.