Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > Expressions > Testing Expressions > SyntaxQ >
Mathematica > Core Language > Procedural Programming > Conditionals > Testing Expressions > SyntaxQ >

SyntaxQ

SyntaxQ
returns True if the string corresponds to syntactically correct input for a single Mathematica expression, and returns False otherwise.
Test if a string is valid Mathematica syntax:
When SyntaxQ gives True, the string can be converted to an expression:
Request input from a dialog repeatedly until it is syntactically correct:
Test if a string is valid Mathematica syntax:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
When SyntaxQ gives True, the string can be converted to an expression:
In[3]:=
Click for copyable input
Out[3]=
 
Request input from a dialog repeatedly until it is syntactically correct:
In[1]:=
Click for copyable input
Out[1]=
New in 2
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF