<p>Yes, a switch statement is present in EV3-G.
Such statement would look like this:
<a href="https://i.sstatic.net/3JIsw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3JIsw.png" alt="enter image description here"></a></p>

<p>However, the only colors you can switch against are black, blue, green, yellow, red, white and brown (the basic lego colors). So unfortunately no orange.</p>

CC BY-SA 4.0
2020-02-15T06:38:09.703Z
2020-02-15T06:38:09.703Z
Michael Verschaeve
<p>I am using an EV3 robot.  </p>

<p>Is there a way to program it using a switch, or another way, to compare multiple colors?  </p>

<p>The goal is to have the robot act as a car and use the color sensor to recognize red to stop, yellow to slow down and green to go in any given order.  </p>

<p>Thanks!</p>

<ev3><sensor-colour>
Is it possible to use a switch with three conditionals and the color sensor to compare?
Stephanie
# Is it possible to use a switch with three conditionals and the color sensor to compare?

(Asked by: username_0 on 2020-02-14)

I am using an EV3 robot.

Is there a way to program it using a switch, or another way, to compare multiple colors?

The goal is to have the robot act as a car and use the color sensor to recognize red to stop, yellow to slow down and green to go in any given order.

Thanks!

**Tags:** ev3, sensor-colour


---

## 1 answers

### Answer by username_1 on 2020-02-15. Score: 1

Yes, a switch statement is present in EV3-G.
Such statement would look like this:
[![enter image description here](https://i.sstatic.net/3JIsw.png)](https://i.sstatic.net/3JIsw.png)

However, the only colors you can switch against are black, blue, green, yellow, red, white and brown (the basic lego colors). So unfortunately no orange.


---

