(do-while)=
# `do while`{l=cs}

There are two possibilities to loop over a block:

::::{grid} 2
:::{grid-item-card}
```{mermaid}
flowchart TD
_s(start) --> a
    a[.] --> b{?}
    b -->|false| a
    b -->|true| _e
_e(end)
```
:::
:::{grid-item-card}
```{mermaid}
flowchart TD
_s(start) --> b{?}
    b -->|false| a[.]
    a --> b
    b -->|true| _e

_e(end)
```
:::
::::

:::::{card} 🤔 Question to ponder
You want to integrate an email input field with input validation in your program, e.g., there must be an `@` in the input string. Which one fits better ?

::::{grid} 2
:::{grid-item-card}
```{mermaid}
flowchart TD
_s(start) --> a
    a[read input] --> b{input valid?}
    b -->|false| a
    b -->|true| c[process input]  --> _e

_e(end)
```
:::
:::{grid-item-card}
```{mermaid}
flowchart TD
_s(start) --> b{input valid?}
    b -->|false| a[read input]
    a --> b
    b -->|true| c[process input]  --> _e

_e(end)
```
:::
::::
:::::

:::{activity} User input
Implement a program that exits if the string 'exit' is read.
:::