You need a comma after "For example" in the first sentence, and before and after in the second one. Both are correct. " That applies to facts, not whether it is grammatical.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.