Printing information with print and printf
The print and printf statements are used to print output from a simulation to the output log. Both of these statements accept any type of expression, as well as multiple expressions separated
by commas. Also, since strings may contain embedded variables, you can format the output of variables however you'd like. See the section on strings ([link]) for more information.
The only difference between print and printf is that printf does not automatically print a newline character. This means that subsequent prints will continue on the same line (as though the "return" key was never hit). This can be
useful if you're trying to produce output in a specific format, but is typically not desirable. If in doubt, stick to print
Here are some examples of print and printf:
# print two variables, side by side. print (self get-time), populationSize. # use a variable embedded in a string. print "the population size is $populationSize". # the following statements would produce the text: # A B C # D E F print "A B C ". print "D E F". # the following statements would produce the text: # A B C D E F printf "A B C ". printf "D E F".
