# How to add to a list?

**URL:** https://www.finalbuilder.com/forums/t/how-to-add-to-a-list/603
**Category:** Discussion
**Created:** [October 3, 2007, 4:09am UTC](https://www.finalbuilder.com/forums/t/how-to-add-to-a-list/603 "2007-10-03T04:09:37Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [October 3, 2007, 4:09am UTC](https://www.finalbuilder.com/forums/t/how-to-add-to-a-list/603/1 "2007-10-03T04:09:37Z")

</div>

In a loop, I test various values and depending on those values I want to add an item to either ListA or ListB.&nbsp;&nbsp; The question I have is how I can add/append an item (for example, file name as a text string) to a variable/list?

\*\*\*\*\*\*\*\*

FileList = file1.txt, file2.txt, file3.txt, file4.txt, file5.txt

Iterate FileList

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If file is of 'this type' then add NextFilename to ListA

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else add NextFilename to ListB

\*\*\*\*\*\*\*\*

So, at the end of the iteration, ListA and ListB might look something like...

ListA: file1.txt, file3.txt

ListB: file2.txt, file4.txt, file5.txt

I will then write actions to process ListA and ListB separately as variables that I can use with the List Iterator action.&nbsp;&nbsp; I am just stuck on how to append items to a list.&nbsp;&nbsp; Suggestions please?

Clive

&nbsp;

&nbsp;

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [October 4, 2007, 1:52am UTC](https://www.finalbuilder.com/forums/t/how-to-add-to-a-list/603/2 "2007-10-04T01:52:15Z")

</div>

Hi Clive,   
  
 There’s an Append To Variable action which should do exactly what you need. :).   
  
 Regards,   
  
 Angus
