> For the complete documentation index, see [llms.txt](https://docs.emobiq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/flow/break.md).

# break

## Description

Will exit the loop (forLoop/whileLoop)

## Input / Parameter

N/A

## Output

N/A

## Callback

N/A

## Example

In this example, we will do console logging by using `console` function in `forLoop` function callback to demonstrate how `break` works.

### Code Equivalent

```
for (let i = 1; i < 10; i++) {
  console.log(i);
  
  if (i == 5) {
    // Exit the loop
    break;
  }
  
  console.log("some text")
}
```

### Steps

1. Drag a `button` component into the canvas and open the `Action` tab. Select the `press` event of the button and drag the `forLoop` function to the event flow, add the value `1` on `start` param and add the value `9` on `end` param.

   ![](/files/EUxRn6uQ5FqlSc6Tzvpw)
2. Drag the function `console` to the `forLoop` function yes callback, on it's `value` param change the param type to input.

   ![](/files/hs902Fcca32FI6mZOZhE)
3. Drag the function `conditional` inside function `forLoop` yes callback, on param `condition` change the param type to subflow/function. Inside param `condition` subflow add `equal` function then on it's `value1` param change the param type to input and on it's `value2` param add value `5`.

   ![](/files/Q3yp5kPBKl1J15MFyMw8)
4. Drag the function `break` inside function `conditional` yes callback.

   ![](/files/NU2ML1xoP3P525jRMDii)
5. Drag the function `console` after function `conditional`, add value `some text` on it's `value` param.

   ![](/files/yfQN8cCwuY04l8UPPho5)

### Result

1. Now click the button in preview, it will show the list current loop number along with `some text` five times on the console before the `break` function stop the loop.

   ![](/files/dYTHmqxe4TGYs7FnLziT)

## Links

### Related Information

See also:

* Functions
  * [conditional](/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/flow/conditional.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/flow/break.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
