> For the complete documentation index, see [llms.txt](https://wiki.redmodding.org/redscript/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.redmodding.org/redscript/references-and-examples/common-patterns/heterogeneous-array-literals.md).

# Heterogeneous array literals

If you define a function to accept an array of `Variant`:

```swift
func AcceptVariants(variants: array<Variant>) {}
```

Then that function can be called with an array literal containing elements of different types:

```swift
// all elements get implicitly converted to Variant
AcceptVariants([1, new Vector2(1, 2), new inkText()]);
// you can achieve the same thing with an explicitly typed local
let variants: array<Variant> = [1, new Vector2(1, 2), new inkText()];
```
