Corrected documentation
This commit is contained in:
parent
5a2e575bb6
commit
a6e660e935
1 changed files with 3 additions and 3 deletions
|
|
@ -3286,18 +3286,18 @@ when declared(initDebugger):
|
|||
when hasAlloc:
|
||||
# XXX: make these the default (or implement the NilObject optimization)
|
||||
proc safeAdd*[T](x: var seq[T], y: T) {.noSideEffect.} =
|
||||
## Add ``y`` to ``x`` unless ``x`` is not yet initialized; in that case,
|
||||
## Adds ``y`` to ``x`` unless ``x`` is not yet initialized; in that case,
|
||||
## ``x`` becomes ``@[y]``
|
||||
if x == nil: x = @[y]
|
||||
else: x.add(y)
|
||||
|
||||
proc safeAdd*(x: var string, y: char) =
|
||||
## Add ``y`` to ``x``. If ``x`` is ``nil`` it is initialized to ``""``
|
||||
## Adds ``y`` to ``x``. If ``x`` is ``nil`` it is initialized to ``""``
|
||||
if x == nil: x = ""
|
||||
x.add(y)
|
||||
|
||||
proc safeAdd*(x: var string, y: string) =
|
||||
## Add ``y`` to ``x`` unless ``x`` is not yet initalized; in that case, ``x``
|
||||
## Adds ``y`` to ``x`` unless ``x`` is not yet initalized; in that case, ``x``
|
||||
## becomes ``y``
|
||||
if x == nil: x = y
|
||||
else: x.add(y)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue