As a Broad Category: It's important to know that 糖果 is a general, catch-all term. While it technically includes chocolate, people will often be more specific and use the word
巧克力 (qiǎokèlì) when talking just about chocolate. Similarly, lollipops are
棒棒糖 (bàngbàngtáng). Using 糖果 is never wrong, but being more specific is also common.