There is no harm in switching between diets as long as you maintain portion control and sustain a calorie deficit or whatever your goal is. However, transitioning between extremes can cause a bit of discomfort or weirdness for a short period of time.