write, f, expr1, expr2, .., exprN | writes the exprI to file f |
write, expr1, expr2, .., exprN | writes the exprI to terminal |
swrite(expr1, expr2, .., exprN) | returns the exprI as a string |
The swrite function returns an array of strings - one string for each line that would have been produced by the write function.
The exprI may be arrays, provided the arrays are conformable. In this case, the exprI are broadcast to the same length L, then the write is applied as if called L times, with successive elements of the exprI written on each call.
Both functions accept an optional format keyword. Write format strings in Yorick have (nearly) the same meaning as the format strings for the ANSI stacndard C library printf routine. In brief, a format string consists of:
For example,
> write, format=" tp %7.4f %e\n", [1.,2.], [.5,.6]
tp 1.0000 5.000000e-01
tp 2.0000 6.000000e-01
>