# Doing Computations in Notebooks

A typical Wolfram System notebook containing text, graphics, and Wolfram Language expressions. The brackets on the right indicate the extent of each cell.

Wolfram System notebooks are structured interactive documents that are organized into a sequence of

*cells*. Each cell may contain text, graphics, sounds or Wolfram Language expressions in any combination. When a notebook is displayed on the screen, the extent of each cell is indicated by a bracket on the right.The notebook front end for the Wolfram Language provides many ways to enter and edit the material in a notebook. Some of these ways will be standard to whatever computer system or graphical interface you are using. Others are specific to the Wolfram Language.

Once you have prepared the material in a cell, you can send it as input to the Wolfram Language kernel simply by pressing Shift+Enter. The kernel will send back whatever output is generated, and the front end will create new cells in your notebook to display this output. Note that if you have a numeric keypad on your keyboard, then you can use its Enter key as an alternative to Shift+Enter.

Most kinds of output that you get in Wolfram System notebooks can readily be edited, just like input. Usually the Wolfram System will convert the output cell into an input cell when you first start editing it.

Once you have done the editing you want, you can typically just press Shift+Enter to send what you have created as input to the Wolfram Language kernel.

If you start editing the output cell

*,*the Wolfram System will automatically change it to an input cell.After you have edited the output, you can send it back as further input to the Wolfram Language kernel.

When you do computations in a Wolfram System notebook, each line of input is typically labeled with In[n]:=, while each line of output is labeled with the corresponding Out[n]=.

There is no reason, however, that successive lines of input and output should necessarily appear one after the other in your notebook. Often, for example, you will want to go back to an earlier part of your notebook, and reevaluate some input you gave before.

It is important to realize that in most cases wherever a particular expression appears in your notebook, it is the line number given in In[n]:= or Out[n]= which determines when the expression was processed by the Wolfram Language kernel. Thus, for example, the fact that one expression may appear earlier than another in your notebook does not mean that it will have been evaluated first by the kernel. This will only be the case if it has a lower line number.

Each line of input and output is given a label when it is evaluated by the kernel. It is these labels, not the position of the expression in the notebook, that indicate the ordering of evaluation by the kernel.

The exception to this rule is when an output contains the formatted results of a Dynamic or Manipulate function. Such outputs will reevaluate in the kernel on an as-needed basis long after the evaluation which initially created them. See "Dynamic Interactivity Language" for more information on this functionality.

As you type, the Wolfram Language applies syntax coloring to your input using its knowledge of the structure of functions. The coloring highlights unmatched brackets and quotes, undefined global symbols, local variables in functions and various programming errors. You can ask why the Wolfram Language colored your input by selecting it and using the Why the Coloring? item in the Help menu.

If you make a mistake and try to enter input that the Wolfram Language kernel does not understand, then the front end will produce a beep and emphasize any syntax errors in the input with color. In general, you will get a beep whenever something goes wrong in the front end. You can find out the origin of the beep using the Why the Beep? item in the Help menu.