# Logic

## Comparison Blocks

[If `then`, do `that`](https://docs.thunkable.com/snap-to-place/control#if-this-do-that) blocks are often paired with statement blocks that test whether a condition is met

The comparison blocks will compare two values and return **true** or **false** based on whether the condition is met.

![](https://689802330-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MXlFNRHdeK_N9XNgmAD%2F-MXldIORWN6DHNiS6c3s%2FScreen%20Shot%202021-04-08%20at%202.21.32%20PM.png?alt=media\&token=ec7a51ea-a1e6-4c94-b883-0f3bd91c6e41)

{% embed url="<https://youtu.be/2Y79qasUIOM>" %}

## And/Or blocks

![](https://689802330-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MXlFNRHdeK_N9XNgmAD%2F-MXldcAyjLWUjurL-Yrb%2FScreen%20Shot%202021-04-08%20at%202.22.59%20PM.png?alt=media\&token=7e0e913a-83ab-4f71-bb99-61b5a20aa8a7)

You can compare multiple conditions at once.

The **and** block will return **true** if both statements are true, **false** otherwise.

The **or** block will return **true** if either statement is true, and **false** if neither statement is true.

## Not

![](https://689802330-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MXlFNRHdeK_N9XNgmAD%2F-MXle-ftfyt4vhVYKxaB%2FScreen%20Shot%202021-04-08%20at%202.24.40%20PM.png?alt=media\&token=e3cd33ce-2cd8-4289-b02c-8267a314660b)

Inverts the value of a true/false statement. Not true = false, not false = true.

## Value Blocks

Value blocks can be used to set the value of a variable. They can be used in conjunction with any of the above blocks.

![](https://689802330-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAn5scXl2uqUJUOqkJo%2F-MXlFNRHdeK_N9XNgmAD%2F-MXleACb6tPZnXYA66ry%2FScreen%20Shot%202021-04-08%20at%202.25.21%20PM.png?alt=media\&token=d87f8248-79cc-4507-80ed-b1b54357dfd2)
