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.

In MOFScript, escaped text is text strings combined with references or function calls. A text strings are represented as text literals, which are signalled by 

These mechanisms are considered equivalent in MOFScript. A string sequence may run over several lines, combining references, function calls and string literals.

'
   public class '
c.name ' extends Serializable {
'

A string literal followed by something else is a concatenation of expressions. A '+' operator can be used to expression the concatenation explicitly. The semantics is  the same.

'
   public class '
+ c.name + ' extends Serializable {
'