Pause a function midway

Pause a function midway

Hi can anyone help me to create a simple slideshow? Is there any way to pause a function that has more then one function inside of it (using callbacks).