File size: 449 Bytes
008360b
 
 
 
 
7c6f75d
008360b
7c6f75d
 
008360b
7c6f75d
008360b
7c6f75d
 
 
008360b
 
7c6f75d
008360b
37e2dba
7c6f75d
008360b
 
 
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
// Array utility operations in AVP

a1 = arr[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

fun sum_array(@init<table> numbers):
    total = 0

    // Iterate through the numbers array
    for n in numbers:
        @mark<total, text, fg> total = total + n
    end for

    return total
end fun

result = sum_array(a1)

fun create_array():
    // Specific syntax for range arrays
    number_arr = arr[1 to 10]
    return number_arr
end fun

result = create_array()