if you create a function, say for example an explosion function, can you call that function ever time there is an explosion in your game or do you have to code it ever time?

Sorry, for the dumb questions, but I'm new and just wanna learn.