API Reference › List › List.reverse
method

List.reverse

List.reverse(s) -> void

Reverses s so its first element becomes last and vice versa, mutating the slice in place rather than returning a copy. Use it to flip an order you built back-to-front — a path traced from goal to start, an undo stack you want oldest-first, or a list you appended to and now want to read in the opposite direction.

Parameters

sthe slice to reverse

Example

program PathOrder {
  var path: []int = new []int

  handler Finalize phase Update {
    # path was built from the goal back to the start
    List.reverse(path)   # now start -> goal
  }
}
← All symbols