Yoyoing with your diet is actually extremely dangerous. A lot of doctors even say that it's more dangerous for your health than just staying fat. Also it's hard to break a yoyo cycle. People who tend to do it get content with their results, and reward themselves with food and breaks from training. It's a vicious cycle of gaining and losing weight.
Health and fitness is all about consistency/dedication.