Author Topic: Chapter 5 properties  (Read 3212 times)

themako1

  • Newbie
  • *
  • Posts: 3
    • View Profile
Chapter 5 properties
« on: May 03, 2015, 06:21:00 PM »
It says "if you assign a default value to a property" it's my understanding that instance variables have to be assigned a vaule when you declare them or you get a compile error

kjmcneish

  • Administrator
  • *****
  • Posts: 719
    • View Profile
Re: Chapter 5 properties
« Reply #1 on: May 04, 2015, 12:59:56 PM »
If a property is marked as optional, you don't need to set an initial value. For example:

Code: [Select]
var middleName: String?
All the best!
Kevin