{"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","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":"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","params":[{"name":"booleanA","type":"Boolean","description":"test condition or variable","type_expr":"Boolean"},{"name":"booleanB","type":"Boolean","description":"test condition or variable","type_expr":"Boolean"}],"returns":{"type":"Boolean","type_expr":"Boolean"},"form":"binary","left":{"text":"booleanA"},"right":{"text":"booleanB"}},{"syntax":"boolean && code","since":"arma2oa 1.62","params":[{"name":"boolean","type":"Boolean","description":"test condition or variable","type_expr":"Boolean"},{"name":"code","type":"Code","description":"code that once executed returns a Boolean. The code is not evaluated if **boolean** is false.","type_expr":"Code"}],"returns":{"type":"Boolean","type_expr":"Boolean"},"form":"binary","left":{"text":"boolean"},"right":{"text":"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};"]}],"aliases":["a and b"],"see_also":["and","or","Operators"]}