{"name":"a = b","operator":"=","title":"a = b","type":"command","url":"https://community.bistudio.com/wiki/a_%3D_b","revid":348661,"updated":"2023-11-08T13:49:04Z","groups":["Variables"],"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":"Assigns the result of expression on the right to the variable on the left. Technically this is not a command and it is not listed in supportInfo; this is more of a compiler instruction.\n\n> [!IMPORTANT]\n> The following structure is invalid: `a = b = c = 4;`.","syntaxes":[{"syntax":"variable = value","params":[{"name":"variable","type":"Anything","description":"see Identifier","type_expr":"Anything"},{"name":"value","type":"Anything","type_expr":"Anything"}],"returns":{"type":"Nothing","type_expr":"Nothing","description":"> [!IMPORTANT] > The returned value is not equivalent to nil. See Notes below for additional information.","text":"Nothing\n\n> [!IMPORTANT]\n> The returned value is not equivalent to nil. See Notes below for additional information."},"form":"binary","left":{"text":"variable"},"right":{"text":"value"}}],"examples":[{"code":["_value = 5;"]},{"code":["_mygroup = group player;"]},{"code":["_greeting = \"Hello!\";"]},{"code":["private _enemyTank = myTank1;"]}],"see_also":["Operators"],"notes":[{"user":"Kronzky","date":"2006-12-15T05:27:00Z","text":"A conditional assignment can be done via the following syntax:\n\n```sqf\n_msg = if (alive player) then {\"you're alive\"} else {\"you're dead\"}\n```"},{"user":"Alef","date":"2009-06-22T16:27:00Z","text":"It's possible to assign to Numbers. Numbers values are not changed. Useful instead of assigning to *nul* or *nil* when a result is of no use.\n\n```sqf\n[player] execVM \"myScript.sqf\"\n```"},{"user":"Dedmen","date":"2016-11-09T00:29:00Z","text":"This operator actually does not return a Nil. It really returns pure Nothing. Not Nil Nothing.\nThis can cause problems. For example:\n\n```sqf\n_var1 = call {\n    _var2 = \"\";\n};\n```\n\nThe return value of the \"call\" is the return value of the \"=\" operator.\nIf it were a nil then of cause \"_var = nil;\" would work just fine.\nBut in reality this causes a \"Generic Error in expression\" because you can't assign pure Nothing to anything"}]}