To add on to this, my understanding is that technically "calories in, calories out" is correct in the sense that weight gain/loss depends on the net caloric intake for your body. But your base metabolic rate, and as a result your daily energy expenditure, is affected by many different things, including the composition of the calories and the timing of the consumption. Insulin plays a major role in weight gain/loss, and simple carbohydrates have a tendency to spike it.