write
Builtin index · REPL & diagnostics
write(v1, v2, ...)orwrite(fileHandle, s)
Input: v1, v2, ... · Output: no output
What it is
Dispatches on the type of the first argument. With ordinary values v1, v2, ... (any printable type): prints them space-joined, without a trailing newline (unlike print/echo). With a fileHandle (the handle object returned by fopen) as the first argument and a string s as the second: instead writes the raw string s to that open file, with no newline added and no console output.
Overloads
2 forms. Each carries its own inputs, outputs and worked example — pick the tab for the one you are calling.
| Code | Input | Output | Description |
result = write(v1, v2, ...) | v1 —not documented yetv2 —not documented yet... repeatablenot documented yet | result — | Prints the values space-joined to the console, with no trailing newline — the ordinary-value form. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
write("a", 1, "b")
print("")
f = fopen("scratch_write_demo.txt", "w")
write(f, "hello file")
close(f)
g = fopen("scratch_write_demo.txt", "r")
print(read_all(g))
close(g)
a 1 b hello file
from repl-diagnostics
| Code | Input | Output | Description |
result = write(fileHandle, s) | fileHandle stringnot documented yets stringnot documented yet | result string | Writes the string s verbatim to the already-open file fileHandle; no console output, no newline added. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
write_csv(df, "data.csv")
df2 = read_csv("data.csv")
print(df2)
table.write(df, "data2.csv")
df3 = table.load("data2.csv")
print(df3)
x y - -- 1 10 2 20 3 -5 x y - -- 1 10 2 20 3 -5
from tour
write("a", 1, "b")
print("")
f = fopen("scratch_write_demo.txt", "w")
write(f, "hello file")
close(f)
g = fopen("scratch_write_demo.txt", "r")
print(read_all(g))
close(g)
a 1 b hello file
from repl-diagnostics
ports = serial_ports()
print("found {length(ports)} port(s): {ports}")
conn = serial_open(ports[0], 115200, timeout_ms = 1000)
write(conn, "MEAS?\n")
line = read_line(conn) ?? "(timed out)"
print(line)
close(conn)
not run by the build — this one needs something the repository cannot supply · from specialized