Files
wren/test/list/subscript_setter.wren
2015-01-20 18:25:54 -08:00

24 lines
353 B
Plaintext

// Basic assignment.
{
var list = [1, 2, 3]
list[0] = 5
list[1] = 6
list[2] = 7
IO.print(list) // expect: [5, 6, 7]
}
// Returns right-hand side.
{
var list = [1, 2, 3]
IO.print(list[1] = 5) // expect: 5
}
// Negative indices.
{
var list = [1, 2, 3]
list[-1] = 5
list[-2] = 6
list[-3] = 7
IO.print(list) // expect: [7, 6, 5]
}