# Simplified syntax for control flows like loops and if/else switches?

**URL:** https://discourse.pymc.io/t/simplified-syntax-for-control-flows-like-loops-and-if-else-switches/10157
**Category:** Questions
**Created:** [August 15, 2022, 12:33pm UTC](https://discourse.pymc.io/t/simplified-syntax-for-control-flows-like-loops-and-if-else-switches/10157 "2022-08-15T12:33:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mschmidt87](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/mschmidt87/32/3317_2.png) [@mschmidt87](https://discourse.pymc.io/u/mschmidt87)
#### Post date: [August 15, 2022, 12:33pm UTC](https://discourse.pymc.io/t/simplified-syntax-for-control-flows-like-loops-and-if-else-switches/10157/1 "2022-08-15T12:33:06Z")

</div>

Hi,  
inspired by two recent topics (one by me: [Probabilistic model with deterministic switch](https://discourse.pymc.io/t/probabilistic-model-with-deterministic-switch/10073) and this topic on loping: [Best Way to Handle a for Loop in pymc4](https://discourse.pymc.io/t/best-way-to-handle-a-for-loop-in-pymc4/10149)), I wanted to ask two general questions:

- Are there good examples in the documentation about these topics? I am not aware of any, perhaps there are and I’ve just missed them. If there aren’t, I think it would be nice to have some examples for those, because honestly, I even thought that using control flow operations like loops or if/else switches in pymc models is not possible at all.

- Would it be feasible to simplify the usability of these operations such that the user is not required to use the `aesara` operations but can leverage some simpified `pymc` syntax perhaps? I was thinking whether it might be possible to create something like `pymc.for` and `pymc.if` that could be used almost like the standard python `for` and `if/else` and be internally translated into `aesara.scan()` and `aesara.switch`, respectively.
