Sweet things have no nutritional value, that is, no vitamins or minerals or anything that is good for your body. They are made up of "empty calories," which means that they have a lot of calories but nothing else.
Sweet things are nothing but simple sugars. The cake or pie or sweet bun is changed by your body into plain sugar, which your body burns up in a short burst, then you feel a crappy, draggy feeling. Any sugar that you body can't use at the moment is stored as fat, and there you go, fat body.
Eating foods with a high sugar content, like candy, in moderation is unlikely to cause a dramatic weight gain. Over-indulging in sugary foods can disrupt your blood sugar and insulin levels, causing your body to store more fat.