mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-12 22:58:40 +01:00
14 lines
450 B
Plaintext
14 lines
450 B
Plaintext
// Returns characters (as strings).
|
|
IO.print("abcd"[0]) // expect: a
|
|
IO.print("abcd"[1]) // expect: b
|
|
IO.print("abcd"[2]) // expect: c
|
|
IO.print("abcd"[3]) // expect: d
|
|
|
|
// Allows indexing backwards from the end.
|
|
IO.print("abcd"[-4]) // expect: a
|
|
IO.print("abcd"[-3]) // expect: b
|
|
IO.print("abcd"[-2]) // expect: c
|
|
IO.print("abcd"[-1]) // expect: d
|
|
|
|
// Make sure the string's internal buffer size is correct.
|
|
IO.print("abcd"[1] == "b") // expect: true |