Last active
May 19, 2018 18:08
-
-
Save dineshba/3c82b8345c67438365c3f84ddb9e890f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if let laptop = programmer.laptop { // set the value of laptop if `programmer.laptop` is not nil and | |
| // enter into if-case or enter into `else` case. | |
| if let laptopFan = laptop.fan { // set the value of laptopFanName if `laptop.fan` is not nil and | |
| // enter into if-case or enter into `else` case. | |
| print("\(laptop.name) contains \(laptopFan.name) fan") | |
| } else { | |
| print("\(laptop.name) contains no fan") // Note: String interpolation "\(value)" | |
| } | |
| } else { | |
| print("\(programmer.name) have no laptop") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment