{"name":"+","operator":"+","title":"+","type":"command","url":"https://community.bistudio.com/wiki/%2B","revid":377977,"updated":"2026-01-19T18:47:06Z","groups":["Math","Arrays","HashMap","Strings"],"status":"ok","games":{"ofp":"1.00","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.00","arma3_since":"0.50","description":"Add two Numbers, concatenate two Arrays or two Strings, or create a copy of an Array or HashMap.\n\n> [!WARNING]\n> Array copy methods `ARRAY + []` and `+ ARRAY` have different behaviours:\n>\n> - `ARRAY + []` creates copy of the 1st dimension, but preserves references in other dimensions ([shallow copy](https://en.wikipedia.org/wiki/Object_copying#Shallow_copy)).\n> - `+ ARRAY` clones every element, so if the array is multi-dimensional, the created copy contains no references ([deep copy](https://en.wikipedia.org/wiki/Object_copying#Deep_copy)).\n>\n> See Example 6.","syntaxes":[{"syntax":"numberA + numberB","params":[{"name":"numberA","type":"Number","type_expr":"Number"},{"name":"numberB","type":"Number","type_expr":"Number"}],"returns":{"type":"Number","type_expr":"Number","description":"the sum of numberA and numberB","text":"Number - the sum of *numberA* and *numberB*"},"form":"binary","left":{"text":"numberA"},"right":{"text":"numberB"}},{"syntax":"+ number","params":[{"name":"number","type":"Number","type_expr":"Number"}],"returns":{"type":"Number","type_expr":"Number","description":"the value of the parameter number","text":"Number - the value of the parameter *number*"},"form":"unary","right":{"text":"number"}},{"syntax":"arrayA + arrayB","params":[{"name":"arrayA","type":"Array of Anything","type_expr":"Array<Anything>"},{"name":"arrayB","type":"Array of Anything","type_expr":"Array<Anything>"}],"returns":{"type":"Array of Anything","type_expr":"Array<Anything>","description":"a new array filled with arrayA and arrayB elements, in that order","text":"Array of Anything - a new array filled with *arrayA* and *arrayB* elements, in that order"},"form":"binary","left":{"text":"arrayA"},"right":{"text":"arrayB"}},{"syntax":"stringA + stringB","params":[{"name":"stringA","type":"String","type_expr":"String"},{"name":"stringB","type":"String","type_expr":"String"}],"returns":{"type":"String","type_expr":"String","description":"a string concatenating stringA and stringB","text":"String - a string concatenating *stringA* and *stringB*"},"form":"binary","left":{"text":"stringA"},"right":{"text":"stringB"}},{"syntax":"+ array","params":[{"name":"array","type":"Array of Anything","type_expr":"Array<Anything>"}],"returns":{"type":"Array of Anything","type_expr":"Array<Anything>","description":"a new instance of the provided array filled with same elements (deep copy)","text":"Array of Anything - a new instance of the provided array filled with same elements ([deep copy](https://en.wikipedia.org/wiki/Object_copying#Deep_copy))"},"form":"unary","right":{"text":"array"}},{"syntax":"+ hashMap","since":"arma3 2.04","params":[{"name":"hashMap","type":"HashMap","type_expr":"HashMap"}],"returns":{"type":"HashMap","type_expr":"HashMap","description":"a new instance of the provided HashMap filled with the same key-value pairs (deep copy)","text":"HashMap - a new instance of the provided HashMap filled with the same key-value pairs ([deep copy](https://en.wikipedia.org/wiki/Object_copying#Deep_copy))"},"form":"unary","right":{"text":"hashMap"}}],"examples":[{"text":"```sqf\n 5 +  3    // returns  8\n-5 + -3    // returns -8\n```","code":[" 5 +  3\t// returns  8\n-5 + -3\t// returns -8"]},{"text":"```sqf\n+  2    // returns  2\n+ -7    // returns -7\n```","code":["+  2\t// returns  2\n+ -7\t// returns -7"]},{"code":["_arrayA = [1,2,3];\n_arrayB = [3,4,5];\n_arrayAB = _arrayA + _arrayB; // _arrayAB = [1,2,3,3,4,5]\n// _arrayA and _arrayB remain unchanged"]},{"code":["_result = \"Hello\" + \" \" + \"there\"; // \"Hello there\""]},{"code":["_arrayA = [1,2,3];\n_arrayB = + _arrayA;\n_arrayB set [0, 99]; // _arrayA = [1,2,3], _arrayB = [99,2,3]"]},{"text":"Shallow copy with `ARRAY + []`:\n\n```sqf\nprivate _subArray = [1, 2, 3];\nprivate _array1 = [_subArray, 1, 2, 3];\nprivate _array2 = _array1 + [];\n_array2 select 0 set [0, \"oops\"];\nhint str _subArray; // [\"oops\", 2, 3]\n```\n\nDeep copy with `+ ARRAY`:\n\n```sqf\nprivate _subArray = [1, 2, 3];\nprivate _array1 = [_subArray, 1, 2, 3];\nprivate _array2 = + _array1;\n_array2 select 0 set [0, \"oops\"];\nhint str _subArray; // [1, 2, 3]\n```","code":["private _subArray = [1, 2, 3];\nprivate _array1 = [_subArray, 1, 2, 3];\nprivate _array2 = _array1 + [];\n_array2 select 0 set [0, \"oops\"];\nhint str _subArray; // [\"oops\", 2, 3]","private _subArray = [1, 2, 3];\nprivate _array1 = [_subArray, 1, 2, 3];\nprivate _array2 = + _array1;\n_array2 select 0 set [0, \"oops\"];\nhint str _subArray; // [1, 2, 3]"]}],"see_also":["Operators","pushBack","append","merge"]}