A template provides a way to write a function that will work with many different data types. Instead of writing one function to sort integers, another to sort strings, and another to sort double, we can write just one function using a template.