# Chaining conditionals

**URL:** https://discourse.julialang.org/t/chaining-conditionals/133295
**Category:** General Usage
**Created:** [October 20, 2025, 7:38am UTC](https://discourse.julialang.org/t/chaining-conditionals/133295 "2025-10-20T07:38:08Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![op3n](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/op3n/32/219070_2.png) [@op3n](https://discourse.julialang.org/u/op3n)
#### Post date: [October 20, 2025, 7:38am UTC](https://discourse.julialang.org/t/chaining-conditionals/133295/1 "2025-10-20T07:38:08Z")

</div>

Hello everyone, I am new to Julia and this discourse, still learning the syntax, please excuse my novice questions

Please let me preface that I have tried to look up the answer before posting this

Is there a way to chain conditionals? Like,

```julia-auto
case = a_very_long_condition
case |= another_very_long_condition

```

I am aware that the syntax can be done in other ways, like using case1, case2; or case = case || another\_very\_long\_condition

Thank you for your time

---

<div class="post-metadata">

### Author: ![JADekker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jadekker/32/210281_2.png) [@JADekker](https://discourse.julialang.org/u/JADekker)
#### Post date: [October 20, 2025, 8:15am UTC](https://discourse.julialang.org/t/chaining-conditionals/133295/2 "2025-10-20T08:15:39Z")

</div>

Does

> case = a || b || c || ….

fit your purposes, where a, b, c,… are conditions?

---

<div class="post-metadata">

### Author: ![TimG](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@TimG](https://discourse.julialang.org/u/TimG)
#### Post date: [October 20, 2025, 8:54am UTC](https://discourse.julialang.org/t/chaining-conditionals/133295/3 "2025-10-20T08:54:39Z")

</div>

> [@op3n](#):
>
> ```julia-auto
> case = a_very_long_condition
> case |= another_very_long_condition
> 
> ```

Yes, this is possible.

```julia-auto
julia> case = false
false

julia> case |= false
false

julia> case |= true
true

julia> case |= false
true

julia> case = true
true

julia> case &= true
true

julia> case &= false
false

julia> case &= true
false
```

---

<div class="post-metadata">

### Author: ![op3n](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/op3n/32/219070_2.png) [@op3n](https://discourse.julialang.org/u/op3n)
#### Post date: [October 20, 2025, 10:44am UTC](https://discourse.julialang.org/t/chaining-conditionals/133295/4 "2025-10-20T10:44:04Z")

</div>

Thank you @TimG i tried it and it threw an error, i will retry the syntax

---

<div class="post-metadata">

### Author: ![eldee](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@eldee](https://discourse.julialang.org/u/eldee)
#### Post date: [October 22, 2025, 3:29pm UTC](https://discourse.julialang.org/t/chaining-conditionals/133295/5 "2025-10-22T15:29:53Z")

</div>

Though note that `x |= y` is equivalent to `x = x | y`, not `x = x || y`. In particular there is no short-circuiting:

```julia-repl
julia> x = true;

julia> x = x || error()
true

julia> x |= error()
ERROR:
Stacktrace:
 [1] error()
   @ Base .\error.jl:44
 [2] top-level scope
   @ REPL[3]:1

```
