> For the complete documentation index, see [llms.txt](https://docs.simplifyqa.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.simplifyqa.ai/introduction-to-test-management-in-simplifyqa/conditional-statements/break-and-continue-statement.md).

# BREAK & CONTINUE Statement

Break and Continue statements in SimplifyQA help control the flow of test execution within loops and conditional structures. These statements provide flexibility in handling test case execution by allowing early exits or skipping specific steps based on conditions.

### Understanding Break and Continue Statements

1. Break Statement
   1. The Break statement is used to exit a loop or stop test execution when a specific condition is met.
   2. Once the condition is met, further steps inside the loop are skipped, and the control moves to the next section of the test case.
2. Continue Statement
   1. The Continue statement is used to skip the current iteration of a loop and proceed to the next one.
   2. This is useful when certain conditions should be ignored while allowing the rest of the loop to execute normally.

### Real-Time Scenario

**Scenario: Validating User Login Attempts**

Consider an application where multiple users attempt to log in. We need to verify successful login attempts while handling invalid login credentials efficiently.

**Using Break Statement**

If a user enters the correct credentials, the test should immediately stop further login attempts and move to the next verification step.

**Using Continue Statement**

If a user enters invalid credentials, the test should skip further checks for that user and proceed with the next set of credentials.

### Best Practices

* Use Break Wisely: Avoid premature termination of loops unless necessary.
* Apply Continue Carefully: Ensure skipping iterations does not impact critical validations.
* Combine with Conditional Statements: Optimise execution logic by pairing with IF-ELSE structures.
* Test with Different Data Sets: Validate break and continue logic across various test scenarios.


---

# 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.simplifyqa.ai/introduction-to-test-management-in-simplifyqa/conditional-statements/break-and-continue-statement.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.
