added example for a function using nonlocal variables (chapter 6)