# Logic Blocks

## Overview

Logic blocks are often paired with [control blocks](/blocks/blocks/control.md) to allow you to create conditional statements, control program flow, and execute specific actions based on predefined conditions. They're fundamental in creating interactive and responsive apps by allowing the block to respond dynamically to different scenarios or inputs.

## Video Tutorial

{% embed url="<https://www.youtube.com/watch?v=qotZVqzTUpg>" %}

## Comparison Blocks

Comparison blocks compare two values and return true or false based on whether or not the condition is met. They are often paired with "if, do" blocks that execute a defined action based on the comparison's true or false status.&#x20;

<div align="left"><img src="/files/6EewjLQ080paNMNTfAXG" alt="" width="375"></div>

## And/Or Blocks

The "and" and "or" blocks allow you to compare multiple conditions.

The "and" block returns true if both statements are true, false otherwise.

The "or" block returns true if either statement is true and false if neither statement is true.

<div align="left"><img src="/files/ASIgJ78vMSV2GW7bEvQG" alt="" width="188"></div>

## Not

The "not" block inverts the value of a true/false statement. It can also be used to check if a value is not null.

<div align="left"><img src="/files/or4KGXt1eiqNvLjItG8n" alt=""></div>

## True/False/Null

The "true," "false," and "null" value blocks are often used in conjunction with the other logic blocks. They can also be used to set the value of a variable.&#x20;

<div align="left"><img src="/files/YP4k9SSCsX3a5h0yjhKm" alt=""></div>

## Type of

The "type of" block returns the type of the connected block. The return value will be "string", "number", "boolean", or "object".

<div align="left"><figure><img src="/files/iHvlWsrLVK6RalNGoPVa" alt="" width="200"><figcaption></figcaption></figure></div>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thunkable.com/blocks/blocks/logic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
