{"name":"a && b","operator":"&&","title":"a && b","type":"command","url":"https://community.bistudio.com/wiki/a_%26%26_b","revid":369259,"updated":"2024-09-03T18:42:01Z","groups":["Variables","Math"],"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":"Returns true only if both conditions are true.\nIn case of the alternative syntax, [lazy evaluation](https://en.wikipedia.org/wiki/Lazy_evaluation#Control_structures) is used - if left operand is false, evaluation of the right side is ignored.","syntaxes":[{"syntax":"booleanA && booleanB","since":null,"effect":null,"exec":null,"params":[{"name":"booleanA","type":"Boolean","optional":false,"default":null,"description":"test condition or variable","types":["Boolean"],"since":null,"text":"booleanA: Boolean - test condition or variable"},{"name":"booleanB","type":"Boolean","optional":false,"default":null,"description":"test condition or variable","types":["Boolean"],"since":null,"text":"booleanB: Boolean - test condition or variable"}],"returns":{"type":"Boolean","types":["Boolean"],"description":null,"text":"Boolean"},"form":"binary","operator":"&&","left":{"text":"booleanA","types":["Boolean"]},"right":{"text":"booleanB","types":["Boolean"]}},{"syntax":"boolean && code","since":"arma2oa 1.62","effect":null,"exec":null,"params":[{"name":"boolean","type":"Boolean","optional":false,"default":null,"description":"test condition or variable","types":["Boolean"],"since":null,"text":"boolean: Boolean - test condition or variable"},{"name":"code","type":"Code","optional":false,"default":null,"description":"code that once executed returns a Boolean. The code is not evaluated if **boolean** is false.","types":["Code"],"since":null,"text":"code: Code - code that once executed returns a Boolean. The code is not evaluated if **boolean** is false."}],"returns":{"type":"Boolean","types":["Boolean"],"description":null,"text":"Boolean"},"form":"binary","operator":"&&","left":{"text":"boolean","types":["Boolean"]},"right":{"text":"code","types":["Code"]}}],"examples":[{"text":"```sqf\nprivate _allEnemiesKilled = true;\nif (alive player && _allEnemiesKilled) then\n{\n    hint \"you win !\";\n};\n```","code":["private _allEnemiesKilled = true;\nif (alive player && _allEnemiesKilled) then\n{\n\thint \"you win !\";\n};"]},{"text":"```sqf\nif ((count _array > 0) && { (_array select 0) == player }) then // an error would be thrown without lazy evaluation\n{\n    hint \"It works!\";\n};\n```","code":["if ((count _array > 0) && { (_array select 0) == player }) then // an error would be thrown without lazy evaluation\n{\n\thint \"It works!\";\n};"]},{"text":"```sqf\nif ((alive player) && { player setDamage 0.5; true }) then // valid AS LONG AS the code block returns a Boolean\n{\n    hint \"It works!\";\n};\n```","code":["if ((alive player) && { player setDamage 0.5; true }) then // valid AS LONG AS the code block returns a Boolean\n{\n\thint \"It works!\";\n};"]}],"multiplayer":null,"problems":null,"aliases":["a and b"],"see_also":["and","or","Operators"],"notes":[],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Math","Command Group: Variables","Introduced with Operation Flashpoint version 1.00","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Take On Helicopters: Scripting Commands"]}