Desktop User Guides > Professional > Using UNICOM Intelligence Professional > Debugging mrScriptBasic code > Syntax errors
 
Syntax errors
UNICOM Intelligence Professional can detect some syntax errors when parsing the script before executing it. Examples of these errors are misspelling a keyword or the name of a variable.
For example, the following code includes two syntax errors: a spelling error on line 3 (the final “n” has been omitted from the name of the Position variable), and the “Then” keyword has been omitted from the If statement on line 5.
Dim Position

Positio = Find("ABDCDEFGHIJKLM", "H")

If Position > 5
  Position = Position + 3
End If
If you run this code, UNICOM Intelligence Professional detects and underlines the errors during the initial parsing stage, and stops before executing the code. If the error is due to a specific word, that word is underlined; otherwise the entire line is underlined.
This graphic is described in the surrounding text.
Press Esc to close the error message. The underlining remains, so you can identify the exact position of the errors.
This graphic is described in the surrounding text.
You cannot edit the script while you are in debugging mode; first, stop the debugging session. Press Ctrl+F5 or choose Stop from the Debug menu. If there has been an error, debugging stops automatically, putting you in edit mode.
Some syntax errors cannot be detected until the code is actually executed. An example of this type of error is spelling a function name incorrectly. For example, suppose, you correct the example, and then misspell the Find function as “Fnd”.
Dim Position
Position = Fnd("ABDCDEFGHIJKLM", "H")
If Position > 5 Then
  Position = Position + 3
End If
When you try to run the code, UNICOM Intelligence Professional finds that there is no function called “Fnd”, so it underlines it and displays an execute error message.
This graphic is described in the surrounding text.
See also
Debugging mrScriptBasic code