Pages

Sunday 10 November 2013

Primitives "show", "print", "write", and "type" in NetLogo

show

show value

Prints value in the Command Center, preceded by this agent, and followed by a carriage return. (This agent is included to help you keep track of what agents are producing which lines of output.) Also, all strings have their quotes included similar to write.

print

print value

Prints value in the Command Center, followed by a carriage return.
This agent is not printed before the value, unlike show.

write

write value

This command will output value, which can be a number, string, list, boolean, or nobody to the Command Center, not followed by a carriage return (unlike print and show).
This agent is not printed before the value, unlike show. Its output also includes quotes around strings and is prepended with a space.
write "hello world"
=>  "hello world"

type

type value

Prints value in the Command Center, not followed by a carriage return (unlike print and show). The lack of a carriage return allows you to print several values on the same line.
This agent is not printed before the value. unlike show.
type 3 type " " print 4
=> 3 4


From NetLogo User Manual

No comments:

Post a Comment