I am new to Swift Programming language. I am learning it from Apple's site. I came across below line of code:
let emptyArray = [String]()
I have asked another question related to this but not completely. I want to know that what are the pros and cons of creating an empty immutable array in Swift. As above line of code contains let keyword, it clearly states that an empty array of string type will be created in memory. My point of interest is that why anyone would be needing that? Is there any use for it? otherwise, Apple wouldn't have allowed it. So I want to know the pros and cons of an example.
Note: I have searched in Google and StackOverflow for my query but did not found the exact reason what I am looking for. So please think before you downvote this question.
Edit: Previously asked question does not address my current question at all. By this question, I want to know that in what scenario(s) I should do it. Why Apple does provide such feature which allows us to create an empty immutable array. Because an empty array there would be no value and after creating it you wouldn't be able to edit its value as its empty and neither you would be able to add or remove any item into/from it. So why compile allows to write such line? Hope I am clear now.