when do you use a comma in a sentence?

When determining when to use a comma in a sentence, there are several rules to consider. Here are some common situations where a comma is used:

1. Separating items in a list: Commas are used to separate multiple items or elements in a series. For example: "I like apples, bananas, and oranges."

2. Before coordinating conjunctions: When two independent clauses are connected by coordinating conjunctions (such as "and," "but," "or," "so"), a comma is used before the conjunction. For example: "She loves to read books, but he prefers watching movies."

3. Introductory phrases or clauses: When a sentence begins with an introductory word, phrase, or clause, a comma is typically placed after it. For example: "After finishing dinner, they went for a walk."

4. Before and after nonessential information: Commas are used to set off nonessential or nonrestrictive information from the rest of the sentence. For example: "My sister, who lives in New York, is an architect."

5. Direct address: When directly addressing someone or something, a comma is used to separate the name or title from the rest of the sentence. For example: "John, can you pass the salt?"

6. Dates, addresses, and numbers: Commas are used to separate parts of dates, addresses, and numbers. For example: "The event will take place on December 31, 2022, in New York City."

Remember, these are just some common situations. There are also additional rules and exceptions to consider. It is always a good idea to consult a reliable grammar guide or style manual for more detailed information.