# TRUE

*LSL constant*

```lsl
integer TRUE = 1;
```

Constant used to define the `TRUE` value in conditional structures or variables/constants in general. Usually it's used because it is more readable, indicating a [boolean](https://wiki.secondlife.com/wiki/Boolean) value instead a [integer](https://wiki.secondlife.com/wiki/Integer) value (1). However, this is an arbitrary distinction in LSL which uses integers to represent Boolean values anyway. It is probably better to consider `TRUE` and [FALSE](/constants/FALSE/) as mnemonic constants for the integer values 1 and 0.

## Examples

<details open>
<summary>Example 1</summary>

```lsl collapse={25-44}
integer q;

default
{
    state_entry()
    {
        q = TRUE;
        if(q)
        {
            llSay(0, "TRUE");
            q = FALSE;
            if(!q)
            {
                llSay(0, "FALSE");
                q = TRUE;
                if(!q)
                {
                    llSay(0, "Won't say this");
                }
                else
                {
                    llSay(0, "TRUE");
                    q = FALSE;
                    if(q)
                    {
                        llSay(0, "Won't say this");
                    }
                    else
                    {
                        llSay(0, "FALSE");
                    }
                }
            }
            else
            {
                llSay(0, "Won't say this");
            }
        }
        else
        {
            llSay(0, "Won't say this");
        }
    }
}
```

</details>

## Notes

- Note that all non-zero integers test as 'true' in statements such as "if (x) ... " but only the value 1 corresponds to `TRUE` as in "if (x == `TRUE`) ..."
- A double exclamation mark can be used to convert any 'true' or [FALSE](/constants/FALSE/) integer to Boolean `TRUE`/[FALSE](/constants/FALSE/) as in "integer Bool = !!value;"

## See also

### Constants

| Constant | Type | Value | Description |
| --- | --- | --- | --- |
| [FALSE](/constants/FALSE/) |  |  |  |

### Articles

- [boolean](https://wiki.secondlife.com/wiki/Boolean)

---

*Source: [TRUE](https://wiki.secondlife.com/wiki/TRUE) on the Second Life Wiki. Content from the Second Life Wiki article TRUE (revision 1194714, 2015-01-24), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/constants/TRUE/
