Forums
Learn
Careers
Store
About
SUBSCRIBE
NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>
Question 1/12: This code is valid Swift – true or false?
Hint: You may only change a struct's properties in a method if the method is marked mutating. Click to show.
mutating
struct Diary { var entries: String mutating func add(entry: String) { entries += "\(entry)" } }
Correct! This code is valid Swift.
Oops – that's not correct. This code is valid Swift.
Return to Review Menu
You are not logged in
Link copied to your pasteboard.