a && b
- Arma 3 v0.50
- First in Operation Flashpoint v1.00
- Alias of a and b
Command · also in Math · Markdown · JSON · original wiki page
Description
Returns true only if both conditions are true. In case of the alternative syntax, lazy evaluation is used - if left operand is false, evaluation of the right side is ignored.
Syntax
Syntax 1
booleanA && booleanB
Parameters:
Returns: Boolean
Syntax 2
since arma2oa 1.62
boolean && code
Parameters:
boolean: Boolean - test condition or variablecode: Code - code that once executed returns a Boolean. The code is not evaluated if boolean is false.
Returns: Boolean
Examples
Example 1
private _allEnemiesKilled = true;
if (alive player && _allEnemiesKilled) then
{
hint "you win !";
};
Example 2
if ((count _array > 0) && { (_array select 0) == player }) then // an error would be thrown without lazy evaluation
{
hint "It works!";
};
Example 3
if ((alive player) && { player setDamage 0.5; true }) then // valid AS LONG AS the code block returns a Boolean
{
hint "It works!";
};