Islam, according to Prophet Muhammad, Sallallahu Alaihi wa Sallam, is consistency.
Consistency in good things, that is.
That means when you start something good, keep it going.
At the same time, Islam also means backing out of a bad thing expeditiously – that is, as quickly as you can.
That means, first of all, try as much as you can to stay away from all bad things. But if at some point you find yourself trapped into something bad, get out of it with all possible speed.