Qu

append_all

Builtin index · Collections & strings

result = append_text(path, s) / append_all(path, s)

Input: path, s · Output: result

What it is

path/s are Strs. Appends s to the end of the file at path, creating it if absent. write_text replaces the whole file instead. append_all is the same builtin under the name that pairs with read_all_text — whole file in, whole string out, no handle in either direction — and both spellings stay, since append_text is already in scripts.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = append_text(path, s) / append_all(path, s)
path Strnot documented yet
s Strnot documented yet
result number
Returns a number: the bytes written.

Examples

No documentation example calls this form yet. The Collections & strings chapter is where one belongs.

How it works

write_text(path, s) / append_text(path, s) — the writing counterparts of read_all_text, which existed alone. Saving a string should not need three calls and a handle. append_all(path, s) is append_text under the name that pairs with read_all_text: whole file in, whole string out, no handle. Two spellings rather than a rename, since append_text is already in scripts.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.

See also

append_text — documented in the same entry.