{"name":"Error Type String Expected Code","title":"Error Type String Expected Code","type":"topic","url":"https://community.bistudio.com/wiki/Error_Type_String_Expected_Code","revid":377941,"updated":"2026-01-11T22:48:39Z","aliases":[],"markdown":"This error occurs when there is a syntax error contained inside a block of code that makes up part of another statement.\nThe error will be identified as being part of the original statement, not on the specific line where it actually occurs.\nFor instance, if there is a syntax error inside an if statement's \"then\" or \"else\" block, the error will be identified in front of the \"then\"/\"else\" keyword.\n\n**Compatibility:**\n\nVersion Unknown\n\n**Example:**\n\n```sqf\nif (_USD + _EUR == 0) then\n{\n    hint \"Your wallet is empty.\";\n}\nelse // the missing semicolon error below is reported to be before this else keyword\n{\n    _output = \"Your wallet contains:\";\n    if (_USD > 0) then\n    {\n        _output = _output + format[\"\\n- %1 USD\", _USD];\n    } // <-- missing semicolon\n\n    if (_EUR > 0) then\n    {\n        _output = _output + format[\"\\n- %1 EUR\", _EUR];\n    } // <-- missing semicolon\n\n    hint _output;\n};\n```\n\nThe missing semicolons on the if statements within the else block will be reported being before the \"else\" command as \"Type String, Expected Code\".\n\n**See Also:**\n\n- When an error makes no sense\n- Error Type Something Expected Nothing","sections":[{"heading":null,"level":1,"markdown":"This error occurs when there is a syntax error contained inside a block of code that makes up part of another statement.\nThe error will be identified as being part of the original statement, not on the specific line where it actually occurs.\nFor instance, if there is a syntax error inside an if statement's \"then\" or \"else\" block, the error will be identified in front of the \"then\"/\"else\" keyword.\n\n**Compatibility:**\n\nVersion Unknown\n\n**Example:**\n\n```sqf\nif (_USD + _EUR == 0) then\n{\n    hint \"Your wallet is empty.\";\n}\nelse // the missing semicolon error below is reported to be before this else keyword\n{\n    _output = \"Your wallet contains:\";\n    if (_USD > 0) then\n    {\n        _output = _output + format[\"\\n- %1 USD\", _USD];\n    } // <-- missing semicolon\n\n    if (_EUR > 0) then\n    {\n        _output = _output + format[\"\\n- %1 EUR\", _EUR];\n    } // <-- missing semicolon\n\n    hint _output;\n};\n```\n\nThe missing semicolons on the if statements within the else block will be reported being before the \"else\" command as \"Type String, Expected Code\".\n\n**See Also:**\n\n- When an error makes no sense\n- Error Type Something Expected Nothing"}],"categories":["Common Scripting Errors"],"groups":["Scripting"]}