Home Explore Blog CI



nushell

commands/docs/export_const.md
70f2aad58ae1af82f79e9d4403ed41ebca5f52c002c9a2d80000000300000455
---
title: export const
categories: |
  core
version: 0.104.0
core: |
  Use parse-time constant from a module and export them from this module.
usage: |
  Use parse-time constant from a module and export them from this module.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

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

<div class='command-title'>Use parse-time constant from a module and export them from this module.</div>

## Signature

```> export 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

Re-export a command from another module
```nu
> module spam { export const foo = 3; }
    module eggs { export use spam foo }
    use eggs foo
    foo

3
```

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

Chunks
560ee927 (1st chunk of `commands/docs/export_const.md`)
Title: export const: Exporting Parse-Time Constants in Nushell
Summary
The `export const` command in Nushell allows you to use and re-export parse-time constants from a module, making them available in the current module's scope. It takes the constant's name and its initial value as input. This command is a parser keyword, offering a way to manage constants within modules.