If
Test for something. If true, then the agent follows the commands attached to the hook.

Description
The If block tests for something. If true, then the agent follows the commands attached to the hook. This is a code block part of the Logic drawer.
Usage
If takes in comparative statements from the Logic drawer to test for a condition. The agent will only follow commands attached to the hook if the statement is true.
Syntax
Inputs in this block:
- A comparative statement block (= statements, > statements, not statement, and/or statements)

Example
This is a game in which the frog attempts to catch flies. The player can move the frog using the arrow keys on the keyboard. The program can process this input using the if block in conjunction with key held? or key typed?.

Related Blocks
- If Else - Tests a condition with alternative actions