---
schema_version: "1"
id: 406e1241f16edd55bb9a70f7fc94d4de195cd38a54148888c215ab8fe27b0276
title: Variable.SetValue
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/guides/mc-programmatic-content/ssjs_utilitiesVariableSetValue.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_utilitiesVariableSetValue.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 4bc829c79fa27ef58b460e6da9c4fd741ac374bbb1998236d3d1e4644a6b8ecb
products:
  - Marketing Cloud Engagement APIs and Programmatic Languages
  - Marketing Cloud
---
# Variable.SetValue

## Overview

Assigns value to a specified variable

### Syntax

Variable.SetValue(1, 2)

### Function Properties

<!--complex table-->

| Ordinal | Type   |              | Description                |
| ------- | ------ | ------------ | -------------------------- |
| **1**   | string | **Required** | Name of variable           |
| **2**   | string | **Required** | Vaue to assign to variable |

## Example

This sample code assigns the specified value to a variable.

```
Variable.SetValue("@myVariable","myValue");
```
