Home Explore Blog CI



nushell

4th chunk of `book/types_of_data.md`
3d4f9ba9ea4b59802ef3f1583e2f91c20e273d182c98d38a0000000100000fe4
| **_Literal Syntax:_** | See [Language Reference - Filesize](/lang-guide/chapters/types/basic_types/filesize.html) |

Nushell also has a special type for file sizes.

As with durations, Nushell supports fractional file sizes and calculations:

```nu
0.5kB
# => 500 B
1GiB / 1B
# => 1073741824
(1GiB / 1B) == 2 ** 30
# => true
```

See the [Language Reference](/lang-guide/chapters/types/basic_types/filesize.html) for a complete list of units and more detail.

### Ranges

|                       |                                                                                                |
| --------------------- | ---------------------------------------------------------------------------------------------- |
| **_Description:_**    | Describes a range of values from a starting value to an ending value, with an optional stride. |
| **_Annotation:_**     | `range`                                                                                        |
| **_Literal Syntax:_** | `<start_value>..<end_value>`. E.g., `1..10`.                                                   |
|                       | `<start_value>..<second_value>..<end_value>`. E.g., `2..4..20`                                 |
| **_See also:_**       | [Language Guide - Range](/lang-guide/chapters/types/basic_types/range.md)                      |

Simple example:

```nu
1..5
# => ╭───┬───╮
# => │ 0 │ 1 │
# => │ 1 │ 2 │
# => │ 2 │ 3 │
# => │ 3 │ 4 │
# => │ 4 │ 5 │
# => ╰───┴───╯
```

::: tip
You can also easily create lists of characters with a form similar to ranges with the command [`seq char`](/commands/docs/seq_char.html) as well as with dates using the [`seq date`](/commands/docs/seq_date.html) command.
:::

### Cell Paths

|                       |                                                                                                                 |
| --------------------- | --------------------------------------------------------------------------------------------------------------- |
| **_Description:_**    | An expression that is used to navigated to an inner value in a structured value.                                |
| **_Annotation:_**     | `cell-path`                                                                                                     |
| **_Literal syntax:_** | A dot-separated list of row (int) and column (string) IDs. E.g., `name.4.5`.                                    |
|                       | Optionally, use a leading `$.` when needed for disambiguation, such as when assigning a cell-path to a variable |
| **_See also:_**       | [Language Reference - Cell-path](/lang-guide/chapters/types/basic_types/cellpath.md)                            |
|                       | [Navigating and Accessing Structured Data](/book/navigating_structured_data.md) chapter.                        |

Simple example:

```nu
let cp = $.2
# Return list item at index 2
[ foo bar goo glue ] | get $cp
# => goo
```

### Closures

|                       |                                                                                                                                                 |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| **_Description:_**    | An anonymous function, often called a lambda function, which accepts parameters and _closes over_ (i.e., uses) variables from outside its scope |
| **_Annotation:_**     | `closure`                                                                                                                                       |
| **_Literal Syntax:_** | `{\|args\| expressions }`                                                                                                                       |
| **_See also:_**       | [Language Reference - Closure](/lang-guide/chapters/types/basic_types/closure.md)                                                               |

Title: Basic Data Types Continued: File Sizes, Ranges, Cell Paths, and Closures
Summary
This section describes the file size, range, cell path, and closure data types in Nushell. File sizes are numeric types representing file sizes, supporting fractional values and calculations. Ranges describe a sequence of values with an optional stride. Cell paths are expressions used to navigate to inner values in structured data using dot-separated row and column IDs. Closures are anonymous functions that accept parameters and can use variables from outside their scope.