> For the complete documentation index, see [llms.txt](https://jexia.gitbook.io/semaphore/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jexia.gitbook.io/semaphore/cookbook/flows/conditional-logic.md).

# Conditional logic

Conditional logic allows for resources only to be executed if a given condition results in a pass. Multiple conditions could be nested which each other.

```bash
flow "IsAdmin" {
	input "org.Input" {}

	if "{{ input:is_admin }}" {
		resource "query" {
			request "proto.Service" "ThrowError" {}
		}
	}

	output "org.Output" {}
}

```

### Complex conditions

Complex conditions could be defined with multiple operators and using multiple resources.

```bash
if "({{ input:has_property }} && {{ input:age }} > 18) && {{ input:is_admin }}" {
	resource "query" {
		request "proto.Service" "ThrowError" {}
	}
}
```
