How Input and Output Work

Steps in the operation of the Wolfram Language.

When you type something like x^2 what the Wolfram Language at first sees is just the string of characters x, ^, 2. But with the usual way that the Wolfram Language is set up, it immediately knows to convert this string of characters into the expression (RefLink[Power, paclet:ref/Power])[x,2].

Then, after whatever processing is possible has been done, the Wolfram Language takes the expression (RefLink[Power, paclet:ref/Power])[x,2] and converts it into some kind of textual representation for output.

The Wolfram Language reads the string of characters x, ^, 2 and converts it to the expression (RefLink[Power, paclet:ref/Power])[x,2]:

x^2

This shows the expression in Fortran form:

FortranForm[%]

(RefLink[FortranForm, paclet:ref/FortranForm]) is just a "wrapper": the value of (RefLink[Out, paclet:ref/Out])[2] is still the expression (RefLink[Power, paclet:ref/Power])[x,2]:

%

It is important to understand that in a typical Wolfram Language session (RefLink[In, paclet:ref/In])[n] and (RefLink[Out, paclet:ref/Out])[n] record only the underlying expressions that are processed, not the textual representations that happen to be used for their input or output.

If you explicitly request a particular kind of output, say by using (RefLink[TraditionalForm, paclet:ref/TraditionalForm])[expr], then what you get will be labeled with (RefLink[Out, paclet:ref/Out])[n]//(RefLink[TraditionalForm, paclet:ref/TraditionalForm]). This indicates that what you are seeing is expr//(RefLink[TraditionalForm, paclet:ref/TraditionalForm]), even though the value of (RefLink[Out, paclet:ref/Out])[n] itself is just expr.

The Wolfram Language also allows you to specify globally that you want output to be displayed in a particular form. And if you do this, then the form will no longer be indicated explicitly in the label for each line. But it is still the case that (RefLink[In, paclet:ref/In])[n] and (RefLink[Out, paclet:ref/Out])[n] will record only underlying expressions, not the textual representations used for their input and output.

This sets t to be an expression with (RefLink[FortranForm, paclet:ref/FortranForm]) explicitly wrapped around it:

t=FortranForm[x^2+y^2]

The result on the previous line is just the expression:

%

But t contains the (RefLink[FortranForm, paclet:ref/FortranForm]) wrapper, and so is displayed in (RefLink[FortranForm, paclet:ref/FortranForm]):

t

Wherever t appears, it is formatted in (RefLink[FortranForm, paclet:ref/FortranForm]):

{t^2,1/t}