Nift - write
Contents
Syntax
The syntax for write calls is:
f++
:
write{option}(ostream, params)
n++
:
@write{option}(ostream, params)
Description
The write function is for writing/printing output, it takes at least two parameters, the first parameter should be an output stream (either console, ofile, a file stream or a string stream), the remainder of the parameters should be either endl for a new line, a variable to print or a number/string to print.
Options
The following options are available for write calls:
| option | description |
|---|---|
| b or block | call follows with a block of text to write/print |
| !pb | do not parse block of text with b/block option |
| f++ | parse block with f++ |
| n++ | parse block with n++ |
| option | description |
f++ example
Examples of write being used with f++:
write(console, "hello, world!", endl)
write{b}(console)
{
First line
Second line
Indented Line
Last line
}
:=(string, s = "hello, world!")
:=(ofstream, ofs("output.txt"))
write(ofs, s, endl)
ofs.close()
n++ example
Examples of read being used with n++:
@write(console, "hello, world!", endl)
@write{b}(console)
{
First line
Second line
Indented Line
Last line
}
@:=(string, s = "hello, world!")
@:=(ofstream, ofs("output.txt"))
@write(ofs, s, endl)
@ofs.close()