Candy is the primary food source in the game to help the player prevent the negative effects of hunger.
Candy is obtained from candy machines, of which there is one in each region of the game. After a candy machine is used, it only dispenses low tier candy such as liquorice and digestive biscuit until a candy machine in a different region has been used. Using three unique candy machines in a row turns the fourth one gold, which dispenses a much more powerful candy such as a golden creme egg.
The player can only hold three candy at a time, and candy machines will not provide more while the player holds this many. Sensible strategy includes eating risky candy in safe places and trying to stock up the best candy for combat (creme eggs and pink nuggets) and eating them all before a planned boss fight. Candy cannot be eaten in combat, it is something you have to just continually obtain and eat as the game goes on. Don't be afraid to obtain a few low tier candy if you need to; the 25% chance of a negative really isn't that bad overall. However there are other solutions too: if you are holding no candy (and no other food e.g. a fae mushroom) then many friendly intelligent NPCs will feed you for free.