> For the complete documentation index, see [llms.txt](https://learn.mechanic.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.mechanic.dev/platform/liquid/keyword-literals/hash.md).

# hash

The `hash` keyword literal may be used in any Liquid code to instantiate a [hash](/platform/liquid/basics/types.md#hash).

Hashes support [assignment by key](/platform/liquid/tags/assign.md#assigning-into-arrays). The [keys](/platform/liquid/filters.md#keys) and [values](/platform/liquid/filters.md#values) filters may be used to quickly access an array of hash keys or values, respectively.

{% hint style="info" %}
The term "hash" comes from Ruby. In Ruby ([docs](https://ruby-doc.org/core-2.5.1/Hash.html)), "A Hash is a dictionary-like collection of unique keys and their values."

In Mechanic's Liquid implementation, a hash can only have string keys.
{% endhint %}

## Example

```liquid
{% assign sizes = hash %}
{% assign sizes["S"] = "Small" %}
{% assign sizes["M"] = "Medium" %}
{% assign sizes["L"] = "Large" %}

{% assign size_abbreviations = sizes | keys %}
{% assign size_labels = sizes | values %}

{% for keyval in sizes %}
  {% assign size_abbreviation = keyval[0] %}
  {% assign size_label = keyval[1] %}

  {{ size_abbreviation }}: {{ size_label }}
{% endfor %}
```


---

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

```
GET https://learn.mechanic.dev/platform/liquid/keyword-literals/hash.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.
