i need advice

so is it fine to be friends with your ex? before me and my ex started dating me and him were good friends but then we realized we had feelings for each other so we started dating, then we broke up. then after we broke up he had asked me if we could still be friends i said sure then we dated again and we haven't talked in 5 months. so the other day he had texted me asking if i wanted to be friends again because he had missed being friends with me and i felt bad so if course i said yes. and he was also talking to a mutual friend of ours and had told my ex that he wanted to ask someone to homecoming, and this was right before he texted me so i don't know what to do if he asks me to homecoming. does anyone have advice for me