项目作者: AJ9

项目描述 :
The supplementary Swift Playground to Swift 101 - nil
高级语言: Swift
项目地址: git://github.com/AJ9/Swift-101-nil.git
创建时间: 2016-10-30T16:44:23Z
项目社区:https://github.com/AJ9/Swift-101-nil

开源协议:MIT License

下载


Swift 101 - nil

The supplementary Swift Playground to Swift 101 - nil.

Playground source

  1. /*:
  2. # Swift 101 - nil
  3. https://medium.com/pretty-swifty/swift-101-nil-423813b56dfb
  4. A super quick blog to go over a key keyword in Swift - `nil`.
  5. */
  6. import UIKit
  7. var notNillableInt: Int = 1 // The key bit here is `: Int`, note that there is no `?`.
  8. //Uncomment the line below to see the compiler complain about assigning notNillableInt to nil.
  9. //notNillableInt = nil
  10. var nillableInt: Int? //This variabled can be assigned nil, here or in the future.
  11. nillableInt = 1
  12. nillableInt = nil