Call a function once or many times