> For the complete documentation index, see [llms.txt](https://docs.rewst.help/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rewst.help/documentation/jinja/data-types.md).

# Jinja data types

Understanding data types is fundamental for effective programming in Jinja templating. This article provides a comprehensive overview of the main data types in Jinja, exploring integers, floats, strings, lists, tuples, dictionaries, sets, booleans, and NoneType.

A *data type* is a classification that specifies the type of value a variable can hold, which determines the operations that can be performed on it and how the data is stored. Understanding data types is fundamental for effective programming in Jinja templating.

### **Integers: Whole numbers**

*Integers* in Jinja are whole numbers without decimal points. Examples include 1, 2, and 3.

```django
{{- 1 -}}
```

### **Floats: Decimal numbers**

*Floats* encompass numbers with decimal points, such as 1.1, 2.2, and 3.14.

```django
{{- 1.1 -}}
```

### **Strings: Textual data**

*Strings* represent words or sentences enclosed in quotes, like "Hello World".

```django
{{- "hello world" -}}
```

### **Lists: Ordered collections**

*Lists* are ordered collections of data, allowing a mix of different types within the same list.

```django
{{- ["hello", "world", 1, 2, 3] -}}
```

Learn how to work with Jinja lists [here](/documentation/jinja/use-cases-and-best-practices/jinja-lists.md), and how to combine Jinja lists [here](/documentation/jinja/use-cases-and-best-practices/general-info.md).

### **Tuples: Immutable pairs**

*Tuples* consist of two or more linked values, enclosed in parentheses and separated by commas. Tuples cannot be changed after creation.

```django
{{- (1, 0) -}}

or

{% set myPair = ("dog", "cat") %}
```

### **Dictionaries: Key-value pairs**

*Dictionaries* store data in key-value pairs, similar to JSON. To retrieve a value from your dictionary, you use the key that you stored the value with. They can be modified and appended to after creation.

```django
{{-
    {
        "name": "rewsty",
        "age": 12908290382,
        "favorite_colors": ["red", "blue", "black", "teal"],
    }
-}}
```

Learn about *dictionary unpacking* [here](/documentation/jinja/common-jinja-examples/dictionary-unpacking.md).

### **Sets: Unique values**

*Sets* are collections of unique values, eliminating duplicates. Converting a list into a set removes duplicate items.

```django
{{- {1, 2, 3} -}}
```

### **Booleans: True or false**

*Booleans* represent truth values and can be either true or false.

```django
{{- true -}}
```

### **NoneType: Null values**

*NoneType* represents null or None values, indicating the absence of a value. To check for NoneType, the keyword `none` is used.

```django
{{- none -}}
```


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.rewst.help/documentation/jinja/data-types.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
