---
title: "element(_:)"
framework: foundationmodels
role: symbol
role_heading: Type Method
path: "foundationmodels/generationguide/element(_:)"
---

# element(_:)

Enforces a guide on the elements within the array.

## Declaration

```swift
static func element<Element>(_ guide: GenerationGuide<Element>) -> GenerationGuide<[Element]> where Value == [Element]
```

## Discussion

Discussion An element generation guide may be used when you want to apply guides to the values a model produces within an array. For example, you may want to generate an array of integers, where all the integers are in the range 0-9. @Generable struct FortuneCookie {     @Guide(description: "A fortune from a fortune cookie")     var name: String

@Guide(description: "A list lucky numbers", .element(.range(0...9)), .count(4))     var luckyNumbers: [Int] }
