---
title: "index(before:)"
framework: createmlcomponents
role: symbol
role_heading: Instance Method
path: "createmlcomponents/slidingwindows/index(before:)"
---

# index(before:)

Returns the position immediately before the given index.

## Declaration

```swift
func index(before i: Int) -> Int
```

## Parameters

- `i`: A valid index of the collection. i must be greater than startIndex.

## Return Value

Return Value The index value immediately before i.

## See Also

### Getting the index

- [index(_:offsetBy:)](createmlcomponents/slidingwindows/index(_:offsetby:).md)
- [index(after:)](createmlcomponents/slidingwindows/index(after:).md)
