Reference · General
print(any...) -> nullWhat it does
Writes its arguments to stdout as one line, each as text and a space between them,
and gives null. A string is written as it is; a value inside a list or map is written
as Quillo writes it, so a string there keeps its quotes. On the server the line goes to
the process's output; in a component it goes to the browser's console.
Examples
print("total:", 3, 2.5, true, null)print([1, "x"], { a: 1, b: "x" })print(`${1 + 1} items`)total: 3 2.5 true null[1, "x"] { a: 1, b: "x" }2 itemsEdge cases
- No arguments print an empty line, and so does the empty string.
- A whole float keeps its
.0; a large float is written in full, never in exponent form (see str). - A newline in a string is printed as a newline: the line becomes two.
- An error value is printed as
err("..."), not as its payload. - The result is
null, soprint(print("x"))printsxand thennull.
print()print(2.0, 1e16, 0.1 + 0.2)print("one\ntwo")print(err("bad"), dec("1.50"))print(print("inner"))2.0 10000000000000000 0.30000000000000004onetwoerr("bad") 1.50innernullErrors
print never fails: any value can be printed, and extra arguments are only more
columns. A value that cannot be shown in a useful way is still shown, as its kind.
print(upper, (x) => x)<builtin upper> <fn <fn>>Chaining
In a pipeline the value comes first, so x | print prints it; print gives null,
so put it last.
[3, 1, 2] | sort | print" hi " | trim | upper | print[1, 2, 3]HISee also
str, type_of, join, json.stringify
Thread 0 posts
On print(): questions, tips, corrections, and code that uses it.
No posts yet. The first one opens the thread.
Edit this page on GitHub · every example's output was made by running it (tools/refcheck.mjs) · questions on Discord or r/quillo