Here is "Hello World" in T3X/0, using only the core module:
USE t3x: t;
DO
t.write(T3X.SYSOUT, "Hello, World!\r\n", 15);
END
Of course this program outputs a CR character on Unix, which is
undesirable. Here is a more correct version using the t.newline
function to output the proper line separator (x::y fetches a byte
from a string, x->y:z is if-then-else, like x?y:z in C).
USE t3x: t;
DO var buffer::3;
t.write(T3X.SYSOUT, "Hello, World!", 13);
t.write(T3X.SYSOUT, t.newline(buffer), buffer::1-> 2: 1);
END
If you want to go the lazy way, use the I/O module, which automatically takes care of all the nitty-gritty details, but generates less efficient code:
USE t3x;
USE string;
USE io;
DO
io.writeln("Hello, World!");
END