chapter 5 - adding in some conditional assignment