{"name":"a or b","operator":"||","title":"a or b","type":"command","url":"https://community.bistudio.com/wiki/a_or_b","revid":349256,"updated":"2023-11-08T14:51:04Z","groups":["Math","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":"Returns true if one or both conditions are true. In case of the alternative syntax, [lazy evaluation](https://en.wikipedia.org/wiki/Lazy_evaluation#Control_structures) is used. That means that if left operand is true, evaluation of the right side is skipped completely.","syntaxes":[{"syntax":"a || 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":"||","left":{"text":"a","types":["Boolean"]},"right":{"text":"b","types":["Boolean"]}},{"syntax":"a || 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* returns true","types":["Code"],"since":null,"text":"b: Code - code that returns Boolean. It is not evaluated if *a* returns true"}],"returns":{"type":"Boolean","types":["Boolean"],"description":null,"text":"Boolean"},"form":"binary","operator":"||","left":{"text":"a","types":["Boolean"]},"right":{"text":"b","types":["Code"]}}],"examples":[{"text":"```sqf\nif (OBJ1 || _enemycount == 0) then { hint \"you win !\" };\n```","code":["if (OBJ1 || _enemycount == 0) then { hint \"you win !\" };"]},{"text":"```sqf\nif (count _array == 0 || { (_array select 0) != player }) then\n{\n    hint \"It works! Without lazy evaluation it would throw an error if array was empty.\";\n};\n```","code":["if (count _array == 0 || { (_array select 0) != player }) then\n{\n\thint \"It works! Without lazy evaluation it would throw an error if array was empty.\";\n};"]}],"multiplayer":null,"problems":null,"aliases":["or"],"see_also":["or","and","Operators"],"notes":[],"categories":[]}