how to use repeat function