---
name: "Error Type String Expected Code"
type: topic
source: https://community.bistudio.com/wiki/Error_Type_String_Expected_Code
revid: 377941
updated: 2026-01-11T22:48:39Z
---

# Error Type String Expected Code

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](../commands/if.md) statement's "[then](../commands/then.md)" or "[else](../commands/else.md)" block, the error will be identified in front of the "[then](../commands/then.md)"/"[else](../commands/else.md)" keyword.

**Compatibility:**

Version Unknown

**Example:**

```sqf
if (_USD + _EUR == 0) then
{
    hint "Your wallet is empty.";
}
else // the missing semicolon error below is reported to be before this else keyword
{
    _output = "Your wallet contains:";
    if (_USD > 0) then
    {
        _output = _output + format["\n- %1 USD", _USD];
    } // <-- missing semicolon

    if (_EUR > 0) then
    {
        _output = _output + format["\n- %1 EUR", _EUR];
    } // <-- missing semicolon

    hint _output;
};
```

The missing semicolons on the if statements within the else block will be reported being before the "else" command as "Type String, Expected Code".

**See Also:**

- [When an error makes no sense](../topics/When_an_error_makes_no_sense.md)
- [Error Type Something Expected Nothing](../topics/Error_Type_Something_Expected_Nothing.md)

<sub>Source: [BI Community Wiki — Error Type String Expected Code](https://community.bistudio.com/wiki/Error_Type_String_Expected_Code) (revision 377941).</sub>
