> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nullftc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Command Based Overview

> CommandKit, a powerful toolkit for building FTC command-based robots.

## What is Command-Based Programming?

In robotics, *command-based programming* refers both to a general programming paradigm and, in our case, to the set of tools provided by CommandKit that make it easier to use.

Command-based programming is a design pattern for organizing robot code. While it’s not the only option, it’s widely used because it helps make code cleaner, more modular, and easier to reuse across seasons.

This paradigm is also an example of **declarative programming**. Instead of writing step-by-step logic that runs every loop, you describe *what the robot should do under certain conditions*. For example, you might say: *“Run this action whenever a condition is true.”*

### With Command-Based

<CodeGroup dropdown>
  ```java theme={null}
  // Java
  new RunnableCommand(() -> {
    telemetry.addData("Hello", "World");
    telemetry.update();
  }, condition::isMet);
  ```

  ```kt theme={null}
  // Kotlin
  idler(condition::isMet) {
    telemetry.addData("Hello", "World")
    telemetry.update()
  }
  ```
</CodeGroup>

### Without Command-Based

Without commands, you would need to manually check conditions and manage control flow inside your loop:

<CodeGroup dropdown>
  ```java theme={null}
  // Java
  if (condition.isMet()) {
    telemetry.addData("Hello", "World");
    telemetry.update();
  } else {
    telemetry.addData("Goodbye", "World");
    telemetry.update();
  }
  ```

  ```kt theme={null}
  // Kotlin
  if (condition.isMet()) {
    telemetry.addData("Hello", "World")
    telemetry.update()
  } else {
    telemetry.addData("Goodbye", "World")
    telemetry.update()
  }
  ```
</CodeGroup>

This approach works, but it makes the code more repetitive and harder to maintain as your robot logic grows.
