file-write2.0

file-write value

This command will output value, which can be a number, string, list, boolean, or nobody to an opened file, not followed by a carriage return (unlike file-print and file-show).

This agent is not printed before the value, unlike file-show. Its output also includes quotes around strings and is prepended with a space. It will output the value in such a manner that file-read will be able to interpret it.

Note that this command is the file i/o equivalent of write, and file-open needs to be called before this command can be used.

file-open "locations.txt"
ask turtles
  [ file-write xcor file-write ycor ]

See also file-print, file-show, file-type, and Output (programming guide).

Take me to the full NetLogo Dictionary