forked from Mirror/wren
List; add swap(index0, index1)
This commit is contained in:
9
test/core/list/swap.wren
Normal file
9
test/core/list/swap.wren
Normal file
@ -0,0 +1,9 @@
|
||||
var list = [0, 1, 2, 3, 4]
|
||||
|
||||
list.swap(0, 3)
|
||||
System.print(list) // expect: [3, 1, 2, 0, 4]
|
||||
|
||||
list.swap(-1, 2)
|
||||
System.print(list) // expect: [3, 1, 4, 0, 2]
|
||||
|
||||
list.swap(8, 0) // expect runtime error: Index 0 out of bounds.
|
||||
Reference in New Issue
Block a user