Document that system:pop() may raise IndexDefect (#21070)

* Document system:pop() may raise IndexDefect

* Add backticks to KeyError
This commit is contained in:
Xavier Noria 2022-12-13 08:47:01 +01:00 • committed by GitHub
commit e4aadcf1c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -1664,6 +1664,8 @@ proc contains*[T](a: openArray[T], item: T): bool {.inline.}=
proc pop*[T](s: var seq[T]): T {.inline, noSideEffect.} =
## Returns the last item of `s` and decreases `s.len` by one. This treats
## `s` as a stack and implements the common *pop* operation.
##
## Raises `IndexDefect` if `s` is empty.
runnableExamples:
var a = @[1, 3, 5, 7]
let b = pop(a)