-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_nested_lists.plain
More file actions
36 lines (30 loc) · 995 Bytes
/
test_nested_lists.plain
File metadata and controls
36 lines (30 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
rem: Test nested lists in PLAIN
task Main()
rem: Simple nested list - list of lists
var matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
display("Matrix:")
display(matrix)
display("")
rem: Access nested elements
display("First row: " & matrix[0])
display("Element at [0][0]: " & matrix[0][0])
display("Element at [1][2]: " & matrix[1][2])
display("")
rem: Mixed nested structures - list containing tables
var people = [
{"name": "Alice", "age": 25},
{"name": "Bob", "age": 30},
{"name": "Carol", "age": 28}
]
display("People:")
display(people)
display("")
rem: Access nested table elements
display("First person: " & people[0])
display("First person's name: " & people[0]["name"])
display("")
rem: Deeply nested list
var deep = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
display("Deeply nested:")
display(deep)
display("Element at [0][1][0]: " & deep[0][1][0])