---
title: isEmpty
framework: swift
role: symbol
role_heading: Instance Property
path: swift/uint128/words-swift.struct/isempty
---

# isEmpty

A Boolean value indicating whether the collection is empty.

## Declaration

```swift
var isEmpty: Bool { get }
```

## Discussion

Discussion When you need to check whether your collection is empty, use the isEmpty property instead of checking that the count property is equal to zero. For collections that don’t conform to RandomAccessCollection, accessing the count property iterates through the elements of the collection. let horseName = "Silver" if horseName.isEmpty {     print("My horse has no name.") } else {     print("Hi ho, \(horseName)!") } // Prints "Hi ho, Silver!") note: O(1)
