# ListApplyToEach

int ListApplyToEach (ListType list, int order, ListApplicationFunc callbackFunction, void *callbackData);

## Purpose

This function takes a list and a callback function and calls the callback for each item in the list.

## Parameters

Input
Name | Type | Description
list | ListType | Pass the list for which the specified function will be called on its items.
order | integer | Specifies whether the items in the list will be visited from first to last (ascending) or from last to first (descending).
callbackFunction | ListApplicationFunc | Pass the function that is to be called for each item in the list. The function must have the following prototype: int CVICALLBACK ListApplicationFunc(int index, void *ptrToItem, void *callbackData); When the function is called, it will be passed the index of the list item it is being called for, a pointer to the contents of the list item, and the user–defined callback data that was passed into ListApplyToEach. If the list application function returns zero or a positive integer, the function will continue to be called for the remaining items in the list. However, if the list application function returns a negative number, then ListApplyToEach will stop and return this number as its result.
callbackData | void * | A user–defined value that will be passed on to Function_To_Apply each time it is called.

## Return Value

Name | Type | Description
result | integer | Returns the result of the last call to Function_To_Apply.