<p>One way of doing this is using a loop and interrupting it.</p>

<p><a href="https://i.sstatic.net/5M9v9.png" rel="noreferrer"><img src="https://i.sstatic.net/5M9v9.png" alt="sample code"></a></p>

<p>How it works:</p>

<p>The "Loop Interrupt" block stops all blocks running inside of the loop, so by interrupting the loop after either wait block, it will stop the other wait block. The type of loop doesn't actually matter because we never reach that point. I chose to wait for "Logic" with a value of "False" just so that it is more clear that we are not actually looping here.</p>

CC BY-SA 3.0
2016-07-10T18:50:27.657Z
2016-07-10T18:56:53.300Z
2016-07-10T18:56:53.300Z
David Lechner
<p>How do you program mindstorms to keep doing a task until either the IR OR the colour sensor state changes. I would like to use the wait block but it can only be either the colour sensor or the IF sensor. i want to continue the activity until either sensor changes to a specified condition. </p>

<ev3><programming><sensor-colour><sensor-ultrasonic>
How do you program mindstorms to keep doing a task until either the IR OR the colour sensor state changes
Emily
# How do you program mindstorms to keep doing a task until either the IR OR the colour sensor state changes

(Asked by: username_0 on 2016-07-10)

How do you program mindstorms to keep doing a task until either the IR OR the colour sensor state changes. I would like to use the wait block but it can only be either the colour sensor or the IF sensor. i want to continue the activity until either sensor changes to a specified condition.

**Tags:** ev3, programming, sensor-colour, sensor-ultrasonic


---

## 1 answers

### Answer by username_1 on 2016-07-10. Score: 6 | Accepted answer

One way of doing this is using a loop and interrupting it.

[![sample code](https://i.sstatic.net/5M9v9.png)](https://i.sstatic.net/5M9v9.png)

How it works:

The "Loop Interrupt" block stops all blocks running inside of the loop, so by interrupting the loop after either wait block, it will stop the other wait block. The type of loop doesn't actually matter because we never reach that point. I chose to wait for "Logic" with a value of "False" just so that it is more clear that we are not actually looping here.


---

