# Trouble with if statments

**URL:** <https://discourse.processing.org/t/trouble-with-if-statments/12210>\
**Category:** Coding Questions\
**Created:** [June 20, 2019, 5:23pm UTC](https://discourse.processing.org/t/trouble-with-if-statments/12210 "2019-06-20T17:23:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asterioapo](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@Asterioapo](https://discourse.processing.org/u/Asterioapo)\
**Post date:** [June 20, 2019, 5:23pm UTC](https://discourse.processing.org/t/trouble-with-if-statments/12210/1 "2019-06-20T17:23:15Z")

</div>

Quite new to Processing and am trying to create a sort of create a character program where you chose options for them. I can get the options to cycle but am struggling to figure out the code to use so that if i press a key the option is selected.

Any help would be appreciated, I’ll post the code below

---

<div class="post-metadata">

**Author:** ![Asterioapo](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@Asterioapo](https://discourse.processing.org/u/Asterioapo)\
**Post date:** [June 20, 2019, 9:47pm UTC](https://discourse.processing.org/t/trouble-with-if-statments/12210/2 "2019-06-20T21:47:12Z")

</div>

```auto
textAlign(CENTER,BOTTOM);
int time = frameCount;
time = frameCount%541;
boolean option1Chosen = false;

//Fur color

if(!keyPressed){
if(time<180){ 
text("Brown fur? Press any key to select.",width/2,height*8/10);
fill(90,70,10);}

else if(time>180 && time<360){
  text("Yellow fur? Press any key to select.",width/2,height*8/10);
  fill(255,255,0);}

else{
  text("Or Blue fur? Press any key to select.",width/2,height*8/10);
  fill(50,150,255);}
}

```

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [June 20, 2019, 11:55pm UTC](https://discourse.processing.org/t/trouble-with-if-statments/12210/3 "2019-06-20T23:55:43Z")

</div>

please post your code ( repair above )  
using the

```auto
</> code tag

```

looks like  
```  
type or paste code here  
```

* * *

using a if to select

- 0 … 180
- 180 … 360
- 360 …  
on a int should work, just to make sure pls print that variable time.

but from the posted code i can not see if that part is running inside draw?  
so make sure the posted code is run / test-able with copy / paste into  
processing IDE 3.5.3

* * *
