<div dir="ltr"><div><div><div><div><div><div>Hi Everyone!<br><br></div>This is my first time emailing the swift evolution list, so if this topic has already been discussed please let me know.  I looked through all the accepted and rejected proposals and it doesn&#39;t seem to be on there.<br><br></div>The main thought is that dictionaries return optionals, so why not arrays?  Or other CollectionTypes for that matter.  I would think this would be the expected behavior in this situation:<br><br>var myArray:[String?] = []<br>print(myArray[4])<br></div>// EXC_BAD_INSTRUCTION, but could just be Optional(nil)<br><br></div>Then you could do things like <br><br></div>if let arrayValue = myArray[4] {<br></div>   // do something<br><div><div>}<br><br></div><div>Of course you could simply check with with the count, but considering Swift&#39;s use of optionals to represent empty variables rather than erroring out or returning an empty String, I think this functionality would be appropriate to include in the Swift standard library.<br><br></div><div>And there&#39;s about 15,000 people who&#39;ve looked for this functionality in the last year: <a href="http://stackoverflow.com/questions/25329186/safe-bounds-checked-array-lookup-in-swift-through-optional-bindings">http://stackoverflow.com/questions/25329186/safe-bounds-checked-array-lookup-in-swift-through-optional-bindings</a>.<br><br></div><div>Please let me know what you think.<br><br></div><div>Best,<br></div><div>Rob Norback<br></div></div></div>