> For the complete documentation index, see [llms.txt](https://gamingmod.gitbook.io/chardscript-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gamingmod.gitbook.io/chardscript-docs/chardscript-tutorial/chardscript-booleans.md).

# ChardScript Booleans

Booleans represent one of two values: `true` or `false`.

***

### Boolean Values

In programming you often need to know if an expression is `true` or `false`.

You can evaluate any expression in ChardScript, and get one of two answers, `1` or `0`, `1` is `true` and `0` is `false`.

When you compare two values, the expression is evaluated and ChardScript returns the Boolean answer:

#### Example

{% code lineNumbers="true" %}

```renpy
echo(10 > 9)
echo(10 == 9)
echo(10 < 9)
```

{% endcode %}

When you run a condition in an if statement, ChardScript returns `true` or `false`:

#### Example

Print a message based on whether the condition is `true` or `false`:

{% code lineNumbers="true" %}

```renpy
call a = 200
call b = 33

if b > a then
  echo("b is greater than a")
else
  echo("b is not greater than a")
end
```

{% endcode %}

### Functions can Return a Boolean

You can create functions that returns a Boolean Value:

#### Example

Print the answer of a function:

{% code lineNumbers="true" %}

```renpy
group myFunction()
  give true
end

echo(myFunction())
```

{% endcode %}

You can execute code based on the Boolean answer of a function:

#### Example

Print "YES!" if the function returns true, otherwise print "NO!":

{% code lineNumbers="true" %}

```renpy
group myFunction()
  give true

if myFunction() then
  print("YES!")
else
  print("NO!")
end
```

{% endcode %}

ChardScript also has many built-in functions that return a boolean value, like`isnumber()`, `isstring()`,`islist()`and`isgroup()`functions.

#### Example

Check if an object is an number or not:

{% code lineNumbers="true" %}

```renpy
call x = 200
echo(isnumber(x))
```

{% endcode %}

#### Example

Check if an object is an string or not:

{% code lineNumbers="true" %}

```renpy
call x = "Hello World!"
echo(isstring(x))
```

{% endcode %}

#### Example

Check if an object is an list or not:

{% code lineNumbers="true" %}

```renpy
call x = ["apple", "banana"]
echo(islist(x))
```

{% endcode %}

#### Example

Check if an object is an function or not:

{% code lineNumbers="true" %}

```renpy
group my_function()
  give "Return from a function"
end

echo(isgroup(x))
```

{% endcode %}
