Is it okay to eat 1 sweet thing?

I’m currently trying to lose weight. I eat a healthy lunch at 12 & then have my last meal of the day at 5pm. Could I still lose weight eating one sweet thing between those hours?