---
name: "a && b"
type: command
operator: "&&"
status: ok
groups: ["Variables", "Math"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/a_%26%26_b
revid: 369259
updated: 2024-09-03T18:42:01Z
---

# a && b

*Command · Variables, Math · Arma 3 v0.50 · introduced in Operation Flashpoint v1.00*

Alias: a and b

## Description

Returns [true](../commands/true.md) only if both conditions are [true](../commands/true.md).
In case of the alternative syntax, [lazy evaluation](https://en.wikipedia.org/wiki/Lazy_evaluation#Control_structures) is used - if left operand is [false](../commands/false.md), evaluation of the right side is ignored.

## Syntax

### Syntax 1

```sqf
booleanA && booleanB
```

**Parameters:**

- `booleanA`: [Boolean](../topics/Boolean.md) - test condition or variable
- `booleanB`: [Boolean](../topics/Boolean.md) - test condition or variable

**Returns:** [Boolean](../topics/Boolean.md)

### Syntax 2

*since arma2oa 1.62*

```sqf
boolean && code
```

**Parameters:**

- `boolean`: [Boolean](../topics/Boolean.md) - test condition or variable
- `code`: [Code](../topics/Code.md) - code that once executed returns a [Boolean](../topics/Boolean.md). The code is not evaluated if **boolean** is [false](../commands/false.md).

**Returns:** [Boolean](../topics/Boolean.md)

## Examples

### Example 1

```sqf
private _allEnemiesKilled = true;
if (alive player && _allEnemiesKilled) then
{
    hint "you win !";
};
```

### Example 2

```sqf
if ((count _array > 0) && { (_array select 0) == player }) then // an error would be thrown without lazy evaluation
{
    hint "It works!";
};
```

### Example 3

```sqf
if ((alive player) && { player setDamage 0.5; true }) then // valid AS LONG AS the code block returns a Boolean
{
    hint "It works!";
};
```

## See also

[and](../commands/and.md) · [or](../commands/or.md) · [Operators](../topics/Operators.md)

<sub>Source: [BI Community Wiki — a && b](https://community.bistudio.com/wiki/a_%26%26_b) (revision 369259).</sub>
