# TIP: All About Arrays

**URL:** <https://forum.servoy.com/t/tip-all-about-arrays/928>\
**Category:** Classic Servoy\
**Created:** [December 31, 2003, 7:23am UTC](https://forum.servoy.com/t/tip-all-about-arrays/928 "2003-12-31T07:23:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.servoy.com/u/david)\
**Post date:** [December 31, 2003, 7:23am UTC](https://forum.servoy.com/t/tip-all-about-arrays/928/1 "2003-12-31T07:23:54Z")

</div>

**Add all your array tips to this thread!**

(1) Make an array out of a field that is a checkbox:

```auto
var myArray = check_field_name.split('\n');

```

A field that is a check box puts a new line character (\n) between each value in the field.

(2) Determine number of array items:

```auto
var myArrayLength = myArray.length;

```

(3) Array elements start numbering from zero. To access an array element:

```auto
var myArrayItem1 = myArray[0];

```

(4) To loop through the elements of an array:

```auto
for ( var i = 0 ; i < myArray.length ; i++ )
{
	application.output(myArray[i]);
}

```

(5) To load a value list with an array:

```auto
application.setValueListItems('valueListName', myArray);

```

“valueListName” needs to already be created as a custom value list.

- david
