when do you use a comma ina sentence

A comma is used in a sentence for various reasons, including:

1. To separate items in a list: I need to buy apples, bananas, and oranges.
2. To separate two independent clauses joined by a coordinating conjunction: I went to the store, and I bought some milk.
3. To set off introductory phrases or words: As a result, we had to start over.
4. To set off interrupting phrases or words: John, however, refused to help.
5. To separate adjectives: She has long, brown hair.
6. To indicate a pause in a sentence: Well, I think we should go now.
7. To separate a direct quotation from the rest of the sentence: "I love you," he said.

It is important to note that the use of commas can vary depending on the specific style guide or grammar rules being followed.