# \#control-flow

**URL:** https://discourse.julialang.org/tag/control-flow/758.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [How to handle errors and prevent script from crashing after](https://discourse.julialang.org/t/how-to-handle-errors-and-prevent-script-from-crashing-after/138168)

<div class="topic-metadata">

**Author:** [@Mervyn\_Larrier](https://discourse.julialang.org/u/Mervyn_Larrier)\
**Replies:** 5\
**Last updated:** [July 14, 2026, 10:32am UTC](https://discourse.julialang.org/t/how-to-handle-errors-and-prevent-script-from-crashing-after/138168 "2026-07-14T10:32:09Z")

</div>

Hi all. I’m writing a script to make a job a little bit easier, and it may be something I share with others so I’m trying to put a bit more care into making it. I’m not very familiar with error handling and I’m struggli…

---

## [Where are control flow labels fully documented?](https://discourse.julialang.org/t/where-are-control-flow-labels-fully-documented/137252)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [May 23, 2026, 7:23am UTC](https://discourse.julialang.org/t/where-are-control-flow-labels-fully-documented/137252 "2026-05-23T07:23:19Z")

</div>

The documentation of @label is rather sparse. I am looking for a comprehensive list of which forms can be preceded by @label my\_label (apparently begin, for, what else?) which forms accept labels (eg break and @got…

---

## [Symbolic.jl: testing for equality of expressions (with no unknown variables)](https://discourse.julialang.org/t/symbolic-jl-testing-for-equality-of-expressions-with-no-unknown-variables/135188)

<div class="topic-metadata">

**Author:** [@Grass](https://discourse.julialang.org/u/Grass)\
**Replies:** 1\
**Last updated:** [January 21, 2026, 5:42pm UTC](https://discourse.julialang.org/t/symbolic-jl-testing-for-equality-of-expressions-with-no-unknown-variables/135188 "2026-01-21T17:42:29Z")

</div>

The purpose of this script is to show that the bijection f (represented by the matrix bijection below) I constructed, from the dihedral group D\_6 to the symmetric group S\_3 on 3 letters, is an isomorphism. I tried to ex…

---

## [Terminate after warning is thrown - global setting](https://discourse.julialang.org/t/terminate-after-warning-is-thrown-global-setting/80368)

<div class="topic-metadata">

**Author:** [@dnldlg](https://discourse.julialang.org/u/dnldlg)\
**Replies:** 6\
**Last updated:** [April 10, 2025, 4:05am UTC](https://discourse.julialang.org/t/terminate-after-warning-is-thrown-global-setting/80368 "2025-04-10T04:05:58Z")

</div>

I want to ensure that my program runs without doing questionable operations. Thus I would like the program to terminate whenever a warning is thrown; i.e. promote a warning to the level of errors. Is there a way to do t…

---

## [Why \`for/if\` syntax is not allowed in loops](https://discourse.julialang.org/t/why-for-if-syntax-is-not-allowed-in-loops/119393)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 6\
**Last updated:** [September 20, 2024, 3:53am UTC](https://discourse.julialang.org/t/why-for-if-syntax-is-not-allowed-in-loops/119393 "2024-09-20T03:53:53Z")

</div>

Hi, I wonder why the combination of for and if is allowed in comprehension like nbe = sum(count(iseven,rv) for rv ∈ rvv if isodd(length(rv));init=0) but has to be written in two separate control flows statement in lo…

---

## [For .... if ... syntax?](https://discourse.julialang.org/t/for-if-syntax/64559)

<div class="topic-metadata">

**Author:** [@dstarerstor](https://discourse.julialang.org/u/dstarerstor)\
**Replies:** 10\
**Last updated:** [June 3, 2024, 5:43pm UTC](https://discourse.julialang.org/t/for-if-syntax/64559 "2024-06-03T17:43:40Z")

</div>

I was just wondering what thoughts people have on the following syntax for iter if cond #stuff here end which would basically be short for for iter if cond #stuff here end end Obviously this isn’t…

---

## [Do nothing in the use of ternary operator](https://discourse.julialang.org/t/do-nothing-in-the-use-of-ternary-operator/90486)

<div class="topic-metadata">

**Author:** [@jisutich](https://discourse.julialang.org/u/jisutich)\
**Replies:** 5\
**Last updated:** [November 19, 2022, 4:16am UTC](https://discourse.julialang.org/t/do-nothing-in-the-use-of-ternary-operator/90486 "2022-11-19T04:16:23Z")

</div>

Hi, I am thinking about a simple question. Suppose I have three numbers a, b and c. And I want to check if the sum of them is zero or not. And I have an object n=0. If the sum is not zero, then I want to set another obj…

---

## [MQTT message topic parsing optimization](https://discourse.julialang.org/t/mqtt-message-topic-parsing-optimization/85151)

<div class="topic-metadata">

**Author:** [@shindler25](https://discourse.julialang.org/u/shindler25)\
**Replies:** 2\
**Last updated:** [August 3, 2022, 1:23pm UTC](https://discourse.julialang.org/t/mqtt-message-topic-parsing-optimization/85151 "2022-08-03T13:23:58Z")

</div>

Hello, The problem: I am designing an MQTT client using GitHub - rweilbacher/MQTT.jl: An asynchronous MQTT client library for julia and am trying to determine the best way to handle incoming messages. messages are handl…

---

## [Nesting a for loop in a while loop](https://discourse.julialang.org/t/nesting-a-for-loop-in-a-while-loop/78336)

<div class="topic-metadata">

**Author:** [@phantom](https://discourse.julialang.org/u/phantom)\
**Replies:** 6\
**Last updated:** [March 25, 2022, 12:24am UTC](https://discourse.julialang.org/t/nesting-a-for-loop-in-a-while-loop/78336 "2022-03-25T00:24:54Z")

</div>

Hi, I apologize if this is a very elementary mistake but I still struggling with programming and Julia. I would like to iterate through a list while a certain conditions hold true. I would also like to be able to stop…

---

## [Is there a "select case" equivalent in Julia?](https://discourse.julialang.org/t/is-there-a-select-case-equivalent-in-julia/66516)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 21\
**Last updated:** [August 19, 2021, 10:58am UTC](https://discourse.julialang.org/t/is-there-a-select-case-equivalent-in-julia/66516 "2021-08-19T10:58:58Z")

</div>

Here is a small Fortran subroutine, with select case, subroutine steps(it) integer(kind=i8) :: it select case (imode) case (11) call step11(it) case (12) call step12(it) case default write (6,'(''Illegal imode …

---

## [A switch type function](https://discourse.julialang.org/t/a-switch-type-function/13491)

<div class="topic-metadata">

**Author:** [@FiniteelementDuan](https://discourse.julialang.org/u/FiniteelementDuan)\
**Replies:** 18\
**Last updated:** [August 13, 2021, 8:16pm UTC](https://discourse.julialang.org/t/a-switch-type-function/13491 "2021-08-13T20:16:13Z")

</div>

It seems that Julia doesn’t support a switch-case type function. I have the following code example, and it wouldn’t pass in Julia: Function Gauss(option) ##Here, option is a string if option ==‘L3’ a=0 end end Wha…

---

## [Julia 2.0: superSwitch or SuperCase ... or generalized if-then-else statement](https://discourse.julialang.org/t/julia-2-0-superswitch-or-supercase-or-generalized-if-then-else-statement/63529)

<div class="topic-metadata">

**Author:** [@blackeneth](https://discourse.julialang.org/u/blackeneth)\
**Replies:** 3\
**Last updated:** [June 25, 2021, 8:30pm UTC](https://discourse.julialang.org/t/julia-2-0-superswitch-or-supercase-or-generalized-if-then-else-statement/63529 "2021-06-25T20:30:38Z")

</div>

Julia doesn’t have a switch/case statement. I recall reading the past that @StefanKarpinski tried to interest the other developers back in the day, but couldn’t get them excited about it. That makes some sense – early on…
