Function: ListConcat
Function: ListConcat

# ListConcat (LIST1, LIST2 )

Finds the index of a value in a list.

### Parameters

Parameter Type Description
LIST1 VALUE(LIST) The first list.
LIST2 VALUE(LIST) The second list.

### Returns

 VALUE(LIST) A new list.

### What It Does

This function takes two lists and concatenates them together into a new list, such that the resulting list contains the elements from the first list and then the elements from the second one. If either value is not a list, it is converted to a list with one element before concatenation (see AsList()).

### List Functions Example

``````
world
{
start()
{
local ret;
local list;

// New
list = listNew(5);
textln(list);
local x = 1;
while (x <= length(list))
{
list[x - 1] = x;
x = x + 1;
}
textln(list);

ret = listAdd(list, 6);						// list = [1, 2, 3, 4, 5, 6], returns true
textln(list + ": " + ret);
ret = listAdd(list, "apple");				// list = [1, 2, 3, 4, 5, 6, "apple"], returns true
textln(list + ": " + ret);

ret = listAddAt(list, 7, 2);				// list = [1, 2, 7, 3, 4, 5, 6, "apple", "banana"], returns true
textln(list + ": " + ret);
ret = listAddAt(list, "banana", 10);		// list = [1, 2, 7, 3, 4, 5, 6, "apple", "banana"], returns true
textln(list + ": " + ret);

// Remove
ret = listRemove(list, 3);					// list = [1, 2, 7, 4, 5, 6, "apple", "banana"], returns true
textln(list + ": " + ret);
ret = listRemove(list, 100);				// list = [1, 2, 7, 4, 5, 6, "apple", "banana"], returns false
textln(list + ": " + ret);

// RemoveAt
ret = listRemoveAt(list, 0);				// list = [2, 7, 4, 5, 6, "apple", "banana"], returns 1
textln(list + ": " + ret);
ret = listRemoveAt(list, 50);				// list = [2, 7, 4, 5, 6, "apple", "banana"], returns false
textln(list + ": " + ret);

// Index
textln(listIndex(list, 4));					// 2
textln(listIndex(list, 1));					// -1
textln(listIndex(list, "4"));				// -1

// Contains
textln(listContains(list, 4));				// true
textln(listContains(list, 1));				// false
textln(listContains(list, "4"));			// false

// Concatenation
textln(listConcat([1, 2, 3], [4, 5, 6]));	// [1, 2, 3, 4, 5, 6]
textln(listConcat([1, 2, 3], 4));			// [1, 2, 3, 4]
textln(listConcat("apple", "orange"));		// ["apple", "orange"]

quit;
}
}
``````