---
title: "getCount"
canonical: "https://help.vicon.com/space/ShogunPost121/1253738615/getCount"
format: markdown
---
# Description

Returns the number of items in the given array. Returns 0 if the variable is not an array or has no elements.

The getCount command helps you to manage different types of objects and arrays. You can also set up loops based on the returned number of objects of interest.

## Functional area

Data retrieval

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `getCount array` |

### Arguments

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `array_variable` |  |  | Name of a module array |

### Flags

None

## Return value

integer

## Examples

```plaintext
string $bones[]; 
$bones  = `getModules -type "BoneNode"`;
int $num = `getCount $bones`;
print $num;
// This script returns the number of BoneNodes in the scene.
```

> Macro (scroll-pagebreak)

# Additional information

## Related commands

- [getModules](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736739)