# dictionary.set()

The `dictionary.set()` function sets the [`$value`](#usdvalue) under the [`$key`](#usdkey) in a global and/or given [`$dictionary`](#usddictionary).&#x20;

{% hint style="info" %}
Global dictionary **is in use** on [`$dictionary-global`](https://docs.angular-package.dev/sass/translator-v0.1.0/dictionary.variables#usddictionary-global-true) set to `true`, or by setting [`$global`](#usdglobal-null) argument to `true`.
{% endhint %}

{% code lineNumbers="true" %}

```scss
// Sass.
@use 'sass:meta';

// Modules.
@use '../../map';

// Functions.
@use 'dictionary.is-global.function' as *;
@use 'dictionary.merge.function' as *;
@use 'dictionary.pick.function' as *;

// Variables.
@forward 'dictionary.variables';
@use 'dictionary.variables' as variables;

// The `translator.dictionary-set()` or `dictionary.set()` function.
@function set($key, $value, $dictionary: (), $global: null) {
  $dictionary: map.set(
    merge(null, pick(null, $dictionary, false), $global),
    $key,
    if(meta.type-of($value) == list, map.retrieve(pick, $value...), $value)
  );
  @if is-global($global) {
    variables.$dictionary: $dictionary;
  }
  @return $dictionary;
}
```

{% endcode %}

{% embed url="<https://github.com/angular-package/sass/blob/main/translator/dictionary/_dictionary.set.function.scss>" %}

### Parameters

#### `$key`

A key under which set [`$value`](#usdvalue).

#### `$value`

A value to set under the [`$key`](#usdkey).

#### `$dictionary: ()`

Additional dictionaries along with a [global dictionary](https://docs.angular-package.dev/sass/translator-v0.1.0/dictionary/dictionary.variables)(if in use) to set [`$value`](#usdvalue) under [`$key`](#usdkey).

The [`$dictionary`](#usddictionary) can be provided as a `map`, or as a `list` where the first element is a dictionary followed by the list of keys to pick([`dictionary.pick()`](https://docs.angular-package.dev/sass/translator-v0.1.0/dictionary/dictionary.pick)) and is merged into a global dictionary(if in use).

#### `$global: null`

A `bool` value indicates whether to use a global dictionary. Default, `null`, then [`$dictionary-global`](https://docs.angular-package.dev/sass/translator-v0.1.0/dictionary/dictionary.variables) is checked.

### Return

The return value is a dictionary with updated [`$value`](#usdvalue) in the [`$key`](#usdkey).

## Examples

```scss
// Use.
@use '@angular-package/sass/translator';

// Examples.



```
