# The match operator

A powerful tool for handling control flow in Rust is the `match` operator. It compares a value against a set of patterns and executes code based on which pattern matches.

```rust
match result {
  Ok(content) => handle(content),
  Err(error) => panic!("Can't deal with: {}", error),
}
```

> "The power of match comes from the expressiveness of the patterns and the fact that the compiler confirms that all possible cases are handled."

[Source](https://doc.rust-lang.org/1.39.0/book/ch06-02-match.html)


---

# 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://notes.eliasnorrby.com/rust/match-operator.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.
