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