Home Explore Blog CI



nushell

lang-guide/chapters/types/basic_types/binary.md
0c8a8d2e5d4152e56ef074105a7611ab9a7f1ce65514e6460000000300000483
# Binary

|                       |                                                              |
| --------------------- | ------------------------------------------------------------ |
| **_Description:_**    | Represents binary data                                       |
| **_Annotation:_**     | `binary`                                                     |
| **_Literal Syntax:_** | `0x[ffffffff]` - hex-based binary representation             |
|                       | `0o[1234567]` - octal-based binary representation            |
|                       | `0b[10101010101]` - binary-based binary representation       |
| **_Casts:_**          | [`into binary`](/commands/docs/into_binary.md)               |
| **_See also:_**       | [Types of data - Binary](/book/types_of_data.md#binary-data) |

## Additional Language Notes

1. Incomplete bytes are left-padded with zeros.

2. Spaces can be used to improve readability. For example, `0x[ffff ffff]`.

## Common commands that can be used with `binary`

- `into bits`
- `bits` subcommands (see `help bits` for a list)
- `bytes` subcommands (see `help bytes` for a list)
- `encode`
- `take`

Chunks
8b57555c (1st chunk of `lang-guide/chapters/types/basic_types/binary.md`)
Title: Binary Data Type in Nu
Summary
This section describes the 'binary' data type in the Nu programming language. It covers the annotation used to represent binary data, literal syntaxes for hex, octal, and binary representations (including padding and readability with spaces), casting using 'into binary', and related commands like 'into bits', 'encode', and 'take'.