{"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","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"variable","type":"Anything","optional":false,"default":null,"description":"see Identifier","types":["Anything"],"since":null,"text":"variable: Anything - see Identifier"},{"name":"value","type":"Anything","optional":false,"default":null,"description":null,"types":["Anything"],"since":null,"text":"value: Anything"}],"returns":{"type":null,"types":["Nothing","nil"],"description":null,"text":"Nothing \n\n> [!IMPORTANT]\n> The returned value is not equivalent to nil. See #Notes below for additional information."},"form":"binary","operator":"=","left":{"text":"variable","types":["Anything"]},"right":{"text":"value","types":["Anything"]}}],"examples":[{"text":"```sqf\n_value = 5;\n```","code":["_value = 5;"]},{"text":"```sqf\n_mygroup = group player;\n```","code":["_mygroup = group player;"]},{"text":"```sqf\n_greeting = \"Hello!\";\n```","code":["_greeting = \"Hello!\";"]},{"text":"```sqf\nprivate _enemyTank = myTank1;\n```","code":["private _enemyTank = myTank1;"]}],"multiplayer":null,"problems":null,"aliases":[],"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.\n\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.\n\nIf it were a nil then of cause \"_var = nil;\" would work just fine.\n\nBut in reality this causes a \"Generic Error in expression\" because you can't assign pure Nothing to anything"}],"categories":[]}