When to Use a Comma Before Such As Here's an example of such as used correctly with a comma in a sentence: In this forest, you'll see many types of coniferous trees, such as pine and spruce. The phrase such as pine and spruce is nonrestrictive, so you need a comma.