aboutsummaryrefslogtreecommitdiff
path: root/docs/LEARN.md
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-15 15:00:36 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-15 15:00:36 +0330
commita5a5029a80a14be46c244b5bcca63e5e2cd9026f (patch)
tree9ba84a7d2c5c0f8bdbba65eb9df57b6129c132e7 /docs/LEARN.md
parentTODO: implicit namespace at the top (diff)
std.Io.print/println take any mix of printable arguments (compiler expands per type); docs, conformance
Diffstat (limited to 'docs/LEARN.md')
-rw-r--r--docs/LEARN.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/LEARN.md b/docs/LEARN.md
index 35ee914..8e0d369 100644
--- a/docs/LEARN.md
+++ b/docs/LEARN.md
@@ -533,7 +533,7 @@ output:
### terminal input and output
-`std.Io` groups the terminal: `print(s)` and `println(s)` write a string, `nl()` a line break, and `put_c`, `put_s`, `put_n`, `put_hex`, `put_bs` and `put_f` write a character, a string, a decimal or hexadecimal integer, a packed byte string and a float. `get_c()`, `eof()`, `read(buf, n)` and `getline(buf, n)` read the program input; `getline` drops the line break and returns -1 at the end of the input. zc has no varargs or overloading, so `print` takes a string only and numbers use their own writers. the writers go through `rt.put_c`, so `std.capture` sees them, and the `rt` names (`rt.put_n` and the rest) keep working.
+`std.Io` groups the terminal: `print(s)` and `println(s)` write a string, `nl()` a line break, and `put_c`, `put_s`, `put_n`, `put_hex`, `put_bs` and `put_f` write a character, a string, a decimal or hexadecimal integer, a packed byte string and a float. `get_c()`, `eof()`, `read(buf, n)` and `getline(buf, n)` read the program input; `getline` drops the line break and returns -1 at the end of the input. `print` and `println` take any number of arguments of any printable type, such as `std.Io.println("total: ", n, " avg: ", x);`; the compiler picks the writer for each argument's type (string, byte string, integer or float), and a fresh owned string argument is freed after it is written. `println()` alone writes a line break. other functions have no varargs or overloading. the writers go through `rt.put_c`, so `std.capture` sees them, and the `rt` names (`rt.put_n` and the rest) keep working.
[example source](../examples/learn/35-io.zc):