This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Dialog

Dialog
initiates a dialog.
Dialog[expr]
initiates a dialog with expr as the current value of .
  • Dialog creates a dialog which consists of a sequence of input and output lines.
  • You can exit a dialog using Return.
  • With the global setting $IgnoreEOF=False, you can also exit a dialog by entering an end-of-file character.
  • If you exit with Return[expr], then expr is the value returned by the Dialog function. Otherwise, the value returned is the expression on the last output line in the dialog.
  • Dialog initially sets the local value of $Line to be equal to its global value. This means that the numbering of input and output lines in the dialog follows the sequence outside the dialog. When the dialog is exited, however, the numbering reverts to the sequence that would be followed if there had been no dialog.
  • Any local value assigned to $Epilog is evaluated when the dialog is exited.
  • The main loop within a dialog uses global variables such as $Pre and $Post.
  • The option DialogSymbols sets up local values for variables within the dialog. DialogSymbols defines initial values for the variables.
  • The option DialogProlog:>expr specifies an expression to evaluate before starting the dialog.
  • Dialog first localizes variables, then evaluates any expression specified by DialogProlog, then evaluates any argument you have given for Dialog.
To evaluate this expression, Mathematica initiates a dialog:
Computations can be done within the dialog just like an ordinary Mathematica session:
Return from the dialog. The value is inserted in the original expression to get Out:
To evaluate this expression, Mathematica initiates a dialog:
In[1]:=
Click for copyable input
Out[1]=
Computations can be done within the dialog just like an ordinary Mathematica session:
In[2]:=
Click for copyable input
Return from the dialog. The value is inserted in the original expression to get Out:
In[3]:=
Click for copyable input
Run a dialog each time through a loop:
You can see the current value of the loop variable in the dialog:
Return from the first dialog. is multiplied by the current value of :
The current values of and :
Return from the second dialog. is multiplied by the current value of squared:
Return from the third dialog:
The value of after the loop:
New in 2