Skip to content

Instantly share code, notes, and snippets.

@fdncred
Last active October 21, 2023 20:25
Show Gist options
  • Save fdncred/cfb828f2bfe2697735e28939ed4e0634 to your computer and use it in GitHub Desktop.
Save fdncred/cfb828f2bfe2697735e28939ed4e0634 to your computer and use it in GitHub Desktop.
Nushell DataTypes

Data Types and How to create them

Validation

You can validate any of these methods to create by using the describe command or the debug --raw command.



Nushell Primitives to Traditional DataTypes

Nushell Primitive Traditional DataType How to create in Nushell Notes
Int byte, short, int, long let n = 1
Decimal float, double, decimal let d = 1.1
String char, string let s = "a string"
Line removed from nu
ColumnPath can't create manually
GlobPattern can't create manually
Boolean boolean let b = $true
Date date/datetime let d = $(date now)
Duration let d = 1min
Range let r = 1..10
FilePath echo "some_file" | into path
Filesize let f = 1mb
Binary can't create manually
Nothing null, nil, \0 let n = $nothing


Nushell UntaggedValues to Traditional DataTypes

UntaggedValue Traditional DataType How to create in Nushell Notes
Row Can't create manually
Table let t = echo [[x, y, z]; [1 2 3] [4 5 6] [7 8 9]]
Error Can't create manually
Block let b = { some command }


Traditional DataTypes to Nushell DataTypes

Traditional DataType Nushell DataType How to create in Nushell Notes
array see Table above
list let l = [1, 2, 4]
enum not yet
record not yet
union not yet
dictionary see Table above
struct not yet
function pointer N/A?
scientific notation N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment