# Are non-scoping \`begin ... end\` blocks useful?

**URL:** https://discourse.julialang.org/t/are-non-scoping-begin-end-blocks-useful/131338
**Category:** General Usage
**Created:** [August 4, 2025, 2:40pm UTC](https://discourse.julialang.org/t/are-non-scoping-begin-end-blocks-useful/131338 "2025-08-04T14:40:34Z")
**Posts on this page:** 1
**Showing post:** 14

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [August 6, 2025, 9:05pm UTC](https://discourse.julialang.org/t/are-non-scoping-begin-end-blocks-useful/131338/14 "2025-08-06T21:05:04Z")

</div>

I use it in one-liners like the following:

```julia
x = (3, "TEMP") # in real code `x` comes from an user terminal input function, which can return nothing

!isnothing(x) && (begin n, dir = x; end)

```

I just remembered one interesting example from [this other post](https://discourse.julialang.org/t/use-condition-result-inside-conditional/52893/6), by the way, which I rewrite here for reference:

```julia-auto
foo() = 3
!isnothing(begin x = foo() end) && println(x)

```

---

_[View the full topic](https://discourse.julialang.org/t/are-non-scoping-begin-end-blocks-useful/131338)._
