Reference · General

print

signature
print(any...) -> null

What 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`)
output
total: 3 2.5 true null[1, "x"] { a: 1, b: "x" }2 items

Edge cases

print()print(2.0, 1e16, 0.1 + 0.2)print("one\ntwo")print(err("bad"), dec("1.50"))print(print("inner"))
output
2.0 10000000000000000 0.30000000000000004onetwoerr("bad") 1.50innernull

Errors

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)
output
<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
output
[1, 2, 3]HI

See also

str, type_of, join, json.stringify

Thread
7Useful? Like it, or add to its thread below.

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