---
name: "and"
type: command
status: ok
groups: ["Variables", "Math"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/and
revid: 349274
updated: 2023-11-08T14:51:11Z
---

# and

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

Alias: [a && b](../commands/a_~26~26_b.md)

## 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
a and b
```

**Parameters:**

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

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

### Syntax 2

*since arma2oa 1.62*

```sqf
a and b
```

**Parameters:**

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

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

## Examples

### Example 1

```sqf
if ((not isNull player) and (alive player) and (_enemycount == 0)) then
{
    hint "you win !";
};
```

### Example 2

```sqf
if ((count _array > 0) and { (_array select 0) == player }) then    // works as expected
{
    hint "It works!";
};

if ((count _array > 0) and (_array select 0) == player) then        // Error: _array select 0 is evaluated
{
    hint "It... works?";
};
```

## See also

[a && b](../commands/a_~26~26_b.md) · [or](../commands/or.md) · [Operators](../topics/Operators.md)

<sub>Source: [BI Community Wiki — and](https://community.bistudio.com/wiki/and) (revision 349274).</sub>
