Well for some, simply avoiding gambling is not possible. And i think there are ways to be safe without avoiding gambling but that would require you to not take gambling personally and to leave emotions out of it. Greed most of the time the reason why people go broke. It's an emotion that you feel when you can't get enough of one thing so i think avoiding getting your feelings involved is the saest way
Losing is the hardest part in gambling but once we can accept that, we will be happy as a gambler.
That is really the whole point of gambling - to make the player having fun and be entertained. If you allocate a certain amount of money that you can afford to lose, then play with all of your emotions and have fun - just think of it that the money you bet is your payment to the casino that gives you fun right at that very moment.