Ink has access to standard input (stdin) and standard output (stdout). You can pipe input to an Ink program in the form |
|
std := load('../vendor/std') scan := std.scan log := std.log f := std.format |
|
To send data to standard output we can use the builtin |
out('Hello, with a manual linebreak. ') log(7) `` print a number log([1, 2]) `` a composite log(() => ()) `` a function log(()) `` or null |
For reading in data from standard input, there is the builtin |
prompt := (msg, cb) => ( log(msg) scan(cb) ) ` usage: prompt('Are you sure?', msg => ( log(msg) ))` |
|
log(f('A message without any passed in values.', {})) log(f('The time is: {{ time }}.', {time: time()})) |
$ ink io.ink Hello, with a manual linebreak. 7 {0: 1, 1: 2} (function) () A message without any passed in values. The time is: 1626466495.20629954. |
Next example: Loops.