I want to be able to create an object of this struct without having to initialize the 2 optional doubles enter image description here
Asked
Active
Viewed 117 times
-2
-
1Please post your code as *text* not as a screenshot. – Martin R Feb 26 '20 at 19:43
-
Looks like a duplicate of https://stackoverflow.com/q/38942325/1187415. – Martin R Feb 26 '20 at 19:45
1 Answers
0
you can use default value for the properties.
init(presentValue: Double, rate: Double, time: Double, frequency: Double = 0.0) {
...
}

Oscar Cardona
- 46
- 1
- 5
-
thank you. Needed to add the argument "futureValue : Double = 0.0" though – Omar d Feb 26 '20 at 20:01