{"name":"and","operator":null,"title":"and","type":"command","url":"https://community.bistudio.com/wiki/and","revid":349274,"updated":"2023-11-08T14:51:11Z","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":"a and b","since":null,"effect":null,"exec":null,"params":[{"name":"a","type":"Boolean","optional":false,"default":null,"description":"test condition or variable","types":["Boolean"],"since":null,"text":"a: Boolean - test condition or variable"},{"name":"b","type":"Boolean","optional":false,"default":null,"description":"test condition or variable","types":["Boolean"],"since":null,"text":"b: Boolean - test condition or variable"}],"returns":{"type":"Boolean","types":["Boolean"],"description":null,"text":"Boolean"},"form":"binary","operator":null,"left":{"text":"a","types":["Boolean"]},"right":{"text":"b","types":["Boolean"]}},{"syntax":"a and b","since":"arma2oa 1.62","effect":null,"exec":null,"params":[{"name":"a","type":"Boolean","optional":false,"default":null,"description":"test condition or variable","types":["Boolean"],"since":null,"text":"a: Boolean - test condition or variable"},{"name":"b","type":"Code","optional":false,"default":null,"description":"code that returns Boolean. It is **not** evaluated if *a* is false","types":["Code"],"since":null,"text":"b: Code - code that returns Boolean. It is **not** evaluated if *a* is false"}],"returns":{"type":"Boolean","types":["Boolean"],"description":null,"text":"Boolean"},"form":"binary","operator":null,"left":{"text":"a","types":["Boolean"]},"right":{"text":"b","types":["Code"]}}],"examples":[{"text":"```sqf\nif ((not isNull player) and (alive player) and (_enemycount == 0)) then\n{\n    hint \"you win !\";\n};\n```","code":["if ((not isNull player) and (alive player) and (_enemycount == 0)) then\n{\n\thint \"you win !\";\n};"]},{"text":"```sqf\nif ((count _array > 0) and { (_array select 0) == player }) then    // works as expected\n{\n    hint \"It works!\";\n};\n\nif ((count _array > 0) and (_array select 0) == player) then        // Error: _array select 0 is evaluated\n{\n    hint \"It... works?\";\n};\n```","code":["if ((count _array > 0) and { (_array select 0) == player }) then\t// works as expected\n{\n\thint \"It works!\";\n};\n\nif ((count _array > 0) and (_array select 0) == player) then\t\t// Error: _array select 0 is evaluated\n{\n\thint \"It... works?\";\n};"]}],"multiplayer":null,"problems":null,"aliases":["a && b"],"see_also":["a && b","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"]}