# How do I test nested Optional\<Any\> for nil?

**URL:** <https://forums.swift.org/t/how-do-i-test-nested-optional-any-for-nil/26622>\
**Category:** Using Swift\
**Tags:** optional\
**Created:** [July 4, 2019, 2:15pm UTC](https://forums.swift.org/t/how-do-i-test-nested-optional-any-for-nil/26622 "2019-07-04T14:15:27Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Nevin](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/nevin/32/617_2.png) [@Nevin](https://forums.swift.org/u/Nevin)\
**Post date:** [July 4, 2019, 2:28pm UTC](https://forums.swift.org/t/how-do-i-test-nested-optional-any-for-nil/26622/2 "2019-07-04T14:28:08Z")

</div>

If you want to flatten an arbitrary-depth `Any?` down to a single layer of optionality, you might find the thread [Challenge: Flattening nested optionals](https://forums.swift.org/t/challenge-flattening-nested-optionals/24083) relevant.

---

_[View the full topic](https://forums.swift.org/t/how-do-i-test-nested-optional-any-for-nil/26622)._
