---
name: "Code vs. Strings"
type: topic
aliases: ["Code Commands", "Code strings"]
source: https://community.bistudio.com/wiki/Code_vs._Strings
revid: 378168
updated: 2026-03-02T16:50:28Z
---

# Code vs. Strings

Since Armed Assault the convention to use quotation marks for [Strings](../topics/String.md) and curly braces for [Code](../topics/Code.md) has been formalised.
Some "exceptions" exist, for example with [onMapSingleClick](../commands/onMapSingleClick.md) and [onDoubleClick](../commands/onDoubleClick.md) that take [String](../topics/String.md) as [Code](../topics/Code.md).\
When scripting, `'abc'` or `"abc"` generally indicates a [String](../topics/String.md) data type, and brackets `{ }` indicate [Code](../topics/Code.md) data type.

In Operation Flashpoint, many language constructs (including [forEach](../commands/forEach.md)) use the concept of "code strings".
Code is passed as a string to them and they interpret it as code if they wish.\
Since Operation Flashpoint v1.85, [Code](../topics/Code.md) is also accepted.

```sqf
// Operation Flashpoint / Armed Assault only!
"_x setDammage 1" forEach _units;

// from Operation Flashpoint v1.85+ up to Arma 3
{ _x setDamage 1 } forEach _units;
```

### Code to String / String to Code

```sqf
_code = { hint "Hello there (code)"; };
_string = "hint 'Hello there (string)';";

_stringCode = compile _string;    // from string to code (Armed Assault v1.00)
_codeString = toString _code;    // from code to string (Arma 3 v2.02)
```

### Code Commands

**Code commands** are any commands from the scripting language expecting a coded statement string as one of their parameters.
Earlier engines accepted code as such when it was provided as a [String](../topics/String.md) using quotation marks, *or* using braces.
Since Armed Assault the engine **specifically** requires braces.
Thus, because the way the engine determines whether it is dealing with code has changed, this list is presented here.

Commands passed as [Code](../topics/Code.md) data type: (as of Arma 3 v2.02)

- &&
- [||](../commands/a_or_b.md)
- [addPublicVariableEventHandler](../commands/addPublicVariableEventHandler.md)
- [and](../commands/and.md)
- [apply](../commands/apply.md)
- [call](../commands/call.md)
- [catch](../commands/catch.md)
- [collect3DENHistory](../commands/collect3DENHistory.md)
- [count](../commands/count.md)
- [default](../commands/default.md)
- [deleteAt](../commands/deleteAt.md)
- [do](../commands/do.md)
- [else](../commands/else.md)
- [exitWith](../commands/exitWith.md)
- [findIf](../commands/findIf.md)
- [forEachMemberAgent](../commands/forEachMemberAgent.md)
- [forEachMemberTeam](../commands/forEachMemberTeam.md)
- [forEachMember](../commands/forEachMember.md)
- [forEach](../commands/forEach.md)
- [for](../commands/for.md)
- [get](../commands/get.md)
- [if](../commands/if.md)
- [in](../commands/in.md)
- [isFinal](../commands/isFinal.md)
- [isNil](../commands/isNil.md)
- [onCommandModeChanged](../commands/onCommandModeChanged.md)
- [onEachFrame](../commands/onEachFrame.md)
- [onGroupIconClick](../commands/onGroupIconClick.md)
- [onGroupIconOverEnter](../commands/onGroupIconOverEnter.md)
- [onGroupIconOverLeave](../commands/onGroupIconOverLeave.md)
- [onHCGroupSelectionChanged](../commands/onHCGroupSelectionChanged.md)
- [onMapSingleClick](../commands/onMapSingleClick.md)
- [onPlayerConnected](../commands/onPlayerConnected.md)
- [onPlayerDisconnected](../commands/onPlayerDisconnected.md)
- [onPreloadFinished](../commands/onPreloadFinished.md)
- [onPreloadStarted](../commands/onPreloadStarted.md)
- [onTeamSwitch](../commands/onTeamSwitch.md)
- [or](../commands/or.md)
- [select](../commands/select.md)
- [spawn](../commands/spawn.md)
- [switch](../commands/switch.md)
- [then](../commands/then.md)
- [toString](../commands/toString.md)
- [try](../commands/try.md)
- [waitUntil](../commands/waitUntil.md)
- [while](../commands/while.md)
- [with](../commands/with.md)

### String Commands

Commands passed as [String](../topics/String.md) data type:

- map [onDoubleClick](../commands/onDoubleClick.md) "[Code](../topics/Code.md)"
- map [onMapSingleClick](../commands/onMapSingleClick.md) "[Code](../topics/Code.md)"

<sub>Source: [BI Community Wiki — Code vs. Strings](https://community.bistudio.com/wiki/Code_vs._Strings) (revision 378168).</sub>
