Printing

Print statements provide output to an output device, which is either a file or ‘standard output’.

println (“public class” + c.name);

If no file is declared, standard output is used as output. If standard output should be forced, a print should be prefixed with ‘stdout’.

stdout.println (“public class” + c.name);

A couple of other utility print functions are defined, to provide easier whitespace management: newline (or nl), tab, or space, followed by an optional count integer. Standard String escape characters (\n\t) are also legal within String literals.

print (“This is a standard print statement “ + aVar.name)
newline (10)
tab(4) <% More escaped output \n\n %>
println (“ /** Documentation output */ ”);

Escaped output

Escaped output provides a different and in some cases simpler way of providing output to a device. Escaped output works similar to most scripting languages, such as Java script.

Escaped output is signaled by escape characters, beginning and ending of an escape. Basically, it is a print statement that can subsume multiple lines and be combined with all expressions that evaluate to a string. Escaped text is signalled by the characters ‘<%’ to start an escape and ‘%>’ to end an escape. Note that all whitespace is copied to the output device.

<%
   public class %>
c.name <% extends Serializable {
%>