it’s always a good idea to consult the docs, i.e. here the ImageJ-macro functions:
There you’ll find:
Outputs a string to the “Log” window. Numeric arguments are automatically converted to strings. The print() function accepts multiple arguments. For example, you can use print(x,y,width, height) instead of print(x+" “+y+” “+width+” "+height). If the first argument is a file handle returned by File.open(path), then the second is saved in the refered file (see SaveTextFileDemo).
Numeric expressions are automatically converted to strings using four decimal places, or use the d2s function to specify the decimal places. For example, print(2/3) outputs “0.6667” but print(d2s(2/3,1)) outputs “0.7”.
The print() function accepts commands such as “\Clear”, “\Update:” and “\Update:” (for n<26) that clear the “Log” window and update its contents. For example, print("\Clear") erases the Log window, print("\Update:new text") replaces the last line with “new text” and print("\Update8:new 8th line") replaces the 8th line with “new 8th line”. Refer to the LogWindowTricks macro for an example.
The second argument to print(arg1, arg2) is appended to a text window or table if the first argument is a window title in brackets, for example print("[My Window]", “Hello, world”). With text windows, newline characters ("\n") are not automatically appended and text that starts with “\Update:” replaces the entire contents of the window. Refer to the PrintToTextWindow, Clock and ProgressBar macros for examples.
The second argument to print(arg1, arg2) is appended to a table (e.g., ResultsTable) if the first argument is the title of the table in brackets. Use the Plugins>New command to open a blank table. Any command that can be sent to the “Log” window ("\Clear", “\Update:” , etc.) can also be sent to a table. Refer to the SineCosineTable2 and TableTricks macros for examples.