Error Type String Expected Code

From Bohemia Interactive Community
Jump to navigation Jump to search

This error occurs when there is a syntax error contained inside a block of code that makes up part of another statement. The error will be identified as being part of the original statement, not on the specific line where it actually occurs. For instance, if there is a syntax error inside an if statement's "then" block or "else" block, the error will be identified in front of the "then" keyword or "else" keyword respectively.


Compatibility:

Version Unknown


Example:

if (_USD + _USDcent + _CAD + _CADcent + _ZWD == 0) then { hint "Your wallet is empty."; } else { _output = "Your wallet contains:"; if (_USD+_USDcent > 0) then { _output = _output + format["\n- United States Dollars: %1.%2 USD", _USD, _USDcent]; } <-- Missing semicolon if (_CAD+_CADcent > 0) then { _output = _output + format["\n- Canadian Dollars: %1.%2 CAD", _CAD, _CADcent]; } <-- Missing semicolon if (_ZWD > 0) then { _output = _output + format["\n- Zimbabwean Dollars: %1 ZWD", _ZWD]; } <-- Missing semicolon ... hint _output; };

There are missing semicolons on each of the if statements within the else block, but the error will be identified as being before the "else" statement as "Type String, Expected Code".


See Also: