This is a built-in variable that is set to indicate the success or failure of some of the commands (not all commands change the value of ErrorLevel). A value of 0 usually indicates success, and any other value usually indicates failure. You can also set the value of ErrorLevel yourself.
Of special interest is that RunWait sets ErrorLevel to be the exit code of the program it ran. Most programs yield an exit code of zero if they completed successfully.
Each thread starts with an ErrorLevel of 0 and retains its own value of ErrorLevel, meaning that if the current thread is interrupted by another, when the original thread is resumed it will still have its original value of ErrorLevel, not the ErrorLevel that may have been set by the interrupting thread.
Although ErrorLevel typically contains a number (most often 0 or 1), the script can assign other types of values to it.
Note: Since some commands set ErrorLevel to values higher than 1, it is best not check whether ErrorLevel is 1, but instead whether ErrorLevel is not zero.
WinWait, MyWindow, , 1 if ErrorLevel ; i.e. it's not blank or zero. MsgBox, The window does not exist. else MsgBox, The window exists.