# If Any & If All

If any and if all blocks are used to check if any of or all of the following conditions are passed before executing a section of code.

Syntax:

{% code overflow="wrap" lineNumbers="true" %}

```python
if (any|all):
  %condition 1%
  %condition 2%
  %condition 3%
  %condition 4%
  ...
then:
  %code%
```

{% endcode %}

If any statements are a much better alternative to having a whole bunch of nested if statements, and an if any statement is much better than having duplicate code under many if statements.

Examples:

{% code overflow="wrap" lineNumbers="true" %}

```python
if any:
  (type of {_item}) = potato
  (type of {_item}) = carrot
then:
  broadcast "{_item} is a vegetable!"

if all:
  (type of {_item}) != apple
  (type of {_item}) != (golden apple)
  (type of {_item}) != (enchanted golden apple)
  (type of {_item}) != (glow berries)
  (type of {_item}) != apple
  (type of {_item}) != (melon slice)
  (type of {_item}) != (chorus fruit)
  (type of {_item}) != (sweet berry)
then:
  broadcast "{_item} is not a fruit!"
```

{% endcode %}


---

# Agent Instructions: 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:

```
GET https://x8ight.gitbook.io/syntask/limiters/conditionals/if-any-and-if-all.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
