Scripting Guide > Data Structures > Lists in JSL Scripts > Insert a Nested List in an Existing List
Publication date: 07/08/2024

Insert a Nested List in an Existing List

To insert a nested list in an existing list, specify the placement of the list:

list2 = {{"a", "b"}, {"c", "d"}};
list2[3] = {"apple", "banana"}; // specify a list as the third item
Show( list2 );

list2 = {{"a", "b"}, {"c", "d"}, {"apple", "banana"}};

If you do not know the number of items in a list, use N Items(). In this example, an empty list is inserted at the end of the list.

list1 = {"a", "b"};
list1[N Items( list1 ) + 1] = {};
Show( list1 );

list1 = {"a", "b", {}};

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).