Created
June 30, 2016 19:41
-
-
Save benglass/d0d95dd4baae706e3aaab59d1035510c to your computer and use it in GitHub Desktop.
This file contains 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
// Write some awesome Swift code, or import libraries like "Foundation", | |
// "Dispatch", or "Glibc" | |
// myProp as a required member variable with default of 0 | |
struct MyStruct1 { | |
var myProp: Double = 0 | |
} | |
let s1 = MyStruct1() | |
print("Target: \(s1.myProp)") | |
// myProp as a required member variable with NO Default | |
struct MyStruct2 { | |
var myProp: Double | |
} | |
let s2 = MyStruct2(myProp: 40) | |
// The following line would be illegal because there is no default myProp value and its required | |
// s2 = MyStruct2() | |
print("Target: \(s2.myProp)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment