Chapter 6 function example