action
set file string-expression modifier-expression? to string-expression
Using set
with a file
expression on the left-hand side is a concise way of creating a file
when the entire contents of the file can be described with a single string
or a single string
source
expression. For example,
define function f (value string file-name, value string source input-data) as set file file-name to input-datais equivalent to
define function f (value string file-name, value string source input-data) as local stream s open s as file file-name put s input-data close sHowever, the former has the advantage of not requiring the intermediate shelf
s
.
As a result of this equivalence, set file
can use the same modifiers as open
.