diff options
Diffstat (limited to 'src/lib/std.zc')
| -rw-r--r-- | src/lib/std.zc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/std.zc b/src/lib/std.zc index b206888..5c86aa6 100644 --- a/src/lib/std.zc +++ b/src/lib/std.zc @@ -421,15 +421,16 @@ struct Host { // called as std.Io.name(args). the writers go through rt.put_c, so a capture // (std.capture) sees their text too. the rt names (rt.put_n, rt.put_s and the // rest) stay; these are the same operations, grouped with the library. -// zc has no varargs or overloading, so print takes a string, and numbers have -// their own writers: std.Io.print("n = "); std.Io.put_n(n); std.Io.nl(); +// print and println take any mix of strings, byte strings, numbers and floats, +// each written by its type: std.Io.println("n = ", n, ", x = ", x); struct Io { - // writes a string. - // s: the text + // writes its arguments in order: any mix of strings, byte strings, numbers + // and floats (the compiler picks the writer for each argument's type). + // s: the first value; more may follow // returns: 0 static int print(char* s) { return rt.put_s(s); } - // writes a string and a line break. - // s: the text + // writes its arguments like print, then a line break. no arguments: just the line break. + // s: the first value; more may follow // returns: 0 static int println(char* s) { rt.put_s(s); return rt.put_c(10); } // writes a line break. |
