---
title: if
slug: if
createdAt: 2021-09-14T17:53:04.000Z
---

A logic operator used to return a defined expression based on the truthiness of one or more other expressions.

### Syntax

`expressionOne if expressionTwo`

- `expressionOne` will be evaluated and returned if `expressionTwo` is evaluated to be truthy.

### Sample usage

`base if directs > 0` returns `base` if `directs` is greater than `0`.

### See also

- [|| (or)](docId\:A7wCSbxwsJEwfYJwbuH8z)&#x20;
- [&& (and)](docId\:UVpXLLWGCPZRpr42E2NXm)&#x20;
- [. (dot)](docId\:t8HBpyTpsANh8YfiZ4YJf)&#x20;

