# Logics

This section covers how to implement conditional logic and control flow when working with encrypted values in FHEVM.

Since encrypted values cannot be directly evaluated at runtime, standard Solidity control flow (`if`, `else`, `for` with encrypted conditions) does not work with FHE ciphertexts. Instead, FHEVM provides specialized functions and patterns to handle these cases securely.

## Topics

* [**Branching**](/protocol/solidity-guides/smart-contract/logics/conditions.md) — How to use `FHE.select` for conditional logic on encrypted values, and how to transition from encrypted conditions to non-encrypted business logic via public decryption.
* [**Dealing with branches and conditions**](/protocol/solidity-guides/smart-contract/logics/loop.md) — Patterns for handling loops and indexed access when the condition or index is encrypted.
* [**Error handling**](/protocol/solidity-guides/smart-contract/logics/error_handling.md) — How to handle errors in FHE computations, where standard `require` and `revert` cannot operate on encrypted values.


---

# 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://docs.zama.org/protocol/solidity-guides/smart-contract/logics.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.
