# Using Let block

**URL:** https://discourse.julialang.org/t/using-let-block/110490
**Category:** General Usage
**Tags:** scope
**Created:** [February 21, 2024, 12:31am UTC](https://discourse.julialang.org/t/using-let-block/110490 "2024-02-21T00:31:54Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![HanD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hand/32/213908_2.png) [@HanD](https://discourse.julialang.org/u/HanD)
#### Post date: [February 22, 2024, 7:36am UTC](https://discourse.julialang.org/t/using-let-block/110490/5 "2024-02-22T07:36:28Z")

</div>

When defining multiple variables in a let block, I tend to favor the following syntax (which I learned about [here](https://discourse.julialang.org/t/tips-on-how-to-use-let-blocks-to-shadow-local-variables-and-avoid-accidentally-modifying-the-original-variable/101467/5) on Discourse, too). In the line of the `let` keyword, I only list the variables to be given a local scope, without their assigned values. And then, in the first fiew lines of the body of the `let` block, I assign their values. E.g.,

```julia
global_value = let x, y
    x = <expression-to-compute-x>
    y = <expression-to-compute-y>
    <expression-using-x-and-y>
end

```

---

_[View the full topic](https://discourse.julialang.org/t/using-let-block/110490)._
