Files
modeling-app/rust/kcl-lib/tests/index_of_array/input.kcl

22 lines
404 B
Plaintext
Raw Normal View History

// This tests indexing an array.
arr = [90, 91, 92]
// Test: literal index.
result0 = arr[1]
assertLessThanOrEq(result0, 91, "Literal property lookup")
assertGreaterThanOrEq(result0, 91, "Literal property lookup")
// Test: computed index.
i = int(1 + 0)
result1 = arr[i]
assertLessThanOrEq(result1, 91, "Computed property lookup")
assertGreaterThanOrEq(result1, 91, "Computed property lookup")