---
schema_version: "1"
id: 9327fcf4f12156254cead8cbbb450271492c4753a6761e0c569a6da2b7c799ac
title: "Handlebars Helper Function: set"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/handlebars/reference/utility/mcn-handlebars-reference-utility-set.md
canonical_url: https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-set.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: fea8685d3b66aa98a48cd24298ef08f215324e122b3c0630190ec1c0c5fc4f29
products:
  - Handlebars for Marketing Cloud Next
  - Marketing Cloud
---
# Handlebars Helper Function: set

Performs local variable assignment within its block scope. It injects one or more variables into the current context for use only within the block. Variables assigned with `set` are local to the block and don’t persist outside the `{{#set}}...{{/set}}` block.

## Availability

This helper is available in the Winter ’26 release of Marketing Cloud Next.

## Syntax

```handlebars
{{#set var1=value1 ... varN=valueN }}
  Block content that can access var1 ... varN.
{{/set}}
```

## Parameters

| Parameter | Type | Description                                                                                                                            |
| --------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `varName` | Any  | Variable name and value pairs such as `name="John"` and `age=30`. Variable names must be valid identifiers. Set at least one variable. |

## Return Value

The function returns the rendered content of the block with all the specified variables available in the context. The variables are available only within the block scope and don’t persist outside of it.

The helper creates a new context by cloning the existing one, adding the provided key-value pairs, and then rendering the inner block with the updated context. This method preserves the parent context. All parent variables remain accessible directly, unlike the `with` helper, which replaces the context.
