Prompted by this post at Chuck Wendig's blog, I'm going to rescind my statement that the only way to fail is to quit.
Instead, let me say this: stopping is not failure. It's entirely possible writing isn't your art form. If you've tried, really REALLY tried, and writing no longer brings you joy, then think about doing something else.
I don't agree with Chuck that one of the ways to measure this is by the number of rejections. Rejections from agents or general trade editors is hardly ever a measure of the quality of your work.
If you've gotten a lot of those, look at other ways of getting your work in front of readers.
But the true measure of whether you want to keep writing is whether you feel joy. If you love to write, keep writing. If you don't, stop.
I consider myself very fortunate to have a job I love, working with people I admire and respect. If writing doesn't make you feel that way most of the time, think about doing something that does.
You can change what you do to express yourself. It's not failure. Failure is not doing what you love.