echo $name # prints "Nu"
}
echo $name # this will fail
```
Once we leave the block above, the `name` variable is no longer visible.
These variables are **immutable** and need to be initialized as they are defined.
Along with variables, we also support "shadowing", so that you can create a variable inside of a scope, and have it "shadow" the variable of the same name outside of the scope:
```
let size = 10
do {
let size = 5
echo $size # prints 5
}
echo $size # prints 10
```
## Environment variables
You can also use `let-env` to create environment variables. Just like variables, they are created in the scope they're defined.
```
let-env TRACE = on
echo $nu.env.TRACE # prints 'on'
```
## Aliases
With 0.25, we've also changed how aliases work to be more like a text expansion, in the spirit of how aliases work in shells like Bash.
```
alias ll = ls -l
ll -a
```
This lets you alias a larger command to a smaller name, and then also pass additional arguments and flags to it.
## Source-ing
You can now also `source` a script, so that the definitions and code of that script runs in the current scope and context.
Let's say we had a file called definitions.nu:
```
# definitions.nu
def add [x, y] {
= x + y
}
```
We can later use the definitions in this file using `source`:
```
source definitions.nu
add 3 7
```
Like variables and definitions, the definitions we `source` are put into the current scope.
```
do {
source definitions.nu
echo $(add 3 7) # prints 10
}
echo $(add 1 11) # errors, `add` isn't in scope here
```
## Breaking changes
- Please note that the `alias` command no longer works the same way it did pre-0.25
Pre-0.25, aliases worked similarly to how `def` works now. We used multiple arguments, and each was optional:
```
alias mycmd [a b c d] { myverylongcommand $a $b $c $d }
```
With 0.25, we no longer pass parameters to alias this way. Instead, think of the aliased name being replaced by the right hand side. To update the previous alias to 0.25, we can write:
```
alias mycmd = myverylongcommand
```
Calling `mycmd 1 2` now expands to `myverylongcommand 1 2` and then runs the expanded command.
## Improvements
- the `which` command now shows if the name points to an alias or custom command (LhKipp)
- you can configure the [style that primities are shown](https://github.com/nushell/nushell/pull/2829) (fdncred)
- optionally you can [highlight trailing spaces](https://github.com/nushell/nushell/pull/2794) (fdncred)
- we support comments now, using `#` (sophiajt)
- better information for debugging in `version` (gillespiecd)
- Thanks to all those who landed general improvements too! (baoyachi, scrabsha, stormasm, max-sixty, ArturKovacs, JosephTLyons)
# Looking forward
This update opens a lot of doors to what's possible with Nushell. There are a few areas we'd like to explore with it: better autocompletions, describing external commands, and more. We'd also really like to hear your feedback on the release so we can continue to improve the overall experience of using Nu.