Comma before a quote:
* When introducing a quote: Use a comma to separate the introductory phrase from the quote.
* Example: "I love this song," she said.
* When attributing a quote: Use a comma to separate the quote from the speaker's name.
* Example: "I'm going to the store," said John.
No comma before a quote:
* When the quote is a continuation of the sentence: If the quote is part of the same sentence as the introductory phrase, don't use a comma.
* Example: The teacher asked, "What is the capital of France?"
* When the quote is an exclamation or question: Don't use a comma when the quote is an exclamation or question.
* Example: She yelled, "Stop!"
Example of both cases:
* "I'm going to the store," said John, "but I'll be back soon."
Remember: Punctuation rules can be complex, and there are always exceptions. If you're unsure, it's always best to consult a style guide or grammar reference.