Home Explore Blog CI



nushell

commands/docs/const.md
89408124f8abb4a81c12e8ec17a5dd3795c736c89b0dfa5200000003000003ab
---
title: const
categories: |
  core
version: 0.104.0
core: |
  Create a parse-time constant.
usage: |
  Create a parse-time constant.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `const` for [core](/commands/categories/core.md)

<div class='command-title'>Create a parse-time constant.</div>

## Signature

```> const {flags} (const_name) (initial_value)```

## Parameters

 -  `const_name`: Constant name.
 -  `initial_value`: Equals sign followed by constant value.


## Input/output types:

| input   | output  |
| ------- | ------- |
| nothing | nothing |
## Examples

Create a new parse-time constant.
```nu
> const x = 10

```

Create a composite constant value
```nu
> const x = { a: 10, b: 20 }

```

## Notes
This command is a parser keyword. For details, check:
  https://www.nushell.sh/book/thinking_in_nu.html

Chunks
ed51a6b0 (1st chunk of `commands/docs/const.md`)
Title: const Command in Nushell
Summary
The `const` command in Nushell is used to create a parse-time constant. It takes the constant name and its initial value as arguments. The command does not take any input and produces no output. It is a parser keyword, allowing the creation of constants with simple or composite values.