# Processing not recognizing enum

**URL:** <https://discourse.processing.org/t/processing-not-recognizing-enum/12899>\
**Category:** Coding Questions\
**Created:** [July 22, 2019, 10:46pm UTC](https://discourse.processing.org/t/processing-not-recognizing-enum/12899 "2019-07-22T22:46:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hey](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hey/32/5889_2.png) [@hey](https://discourse.processing.org/u/hey)\
**Post date:** [July 22, 2019, 10:46pm UTC](https://discourse.processing.org/t/processing-not-recognizing-enum/12899/1 "2019-07-22T22:46:13Z")

</div>

I am trying to program an interpreter in Processing, and I’m trying to use enums. However, when I try to reference one of the values from the enum, Processing tells me that the value cannot be resolved into a variable.

---

<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:** [July 23, 2019, 1:49am UTC](https://discourse.processing.org/t/processing-not-recognizing-enum/12899/2 "2019-07-23T01:49:25Z")

</div>

?? this might be still valid:  
[https://stackoverflow.com/questions/13370090/enums-in-processing-2-0](https://stackoverflow.com/questions/13370090/enums-in-processing-2-0) ?  
enum\_test.pde

```auto
Status status;

```

enum\_code.java

```auto

enum Status { STOPPED,MOVING };

```

but i have no idea what i am talking about, just good in google search

---

<div class="post-metadata">

**Author:** ![hey](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hey/32/5889_2.png) [@hey](https://discourse.processing.org/u/hey)\
**Post date:** [July 23, 2019, 3:27am UTC](https://discourse.processing.org/t/processing-not-recognizing-enum/12899/3 "2019-07-23T03:27:53Z")

</div>

I have the enum code in a java file with that general syntax, and it does seem to recognize the enum typing; however, the problem seems to lie in me trying to define a variable of that enum typing with a value from the enum.

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [July 25, 2019, 7:13pm UTC](https://discourse.processing.org/t/processing-not-recognizing-enum/12899/4 "2019-07-25T19:13:36Z")

</div>

I don’t know much about this.

processing seems to have advanced in terms of using `enum`

here is an example where we **don’t have** a _java tab_

Chrisir

```auto
// https://forum.processing.org/two/discussion/7048/easiest-way-to-make-a-finite-state-machine

public enum State {
  SETUP, RADAR, POINTER, HISTOGRAM;
}

private State _state = State.SETUP;

// ------------------------------------------------

void setup() {
  size(1220, 950);
}

void draw() {

  background(111); 

  switch(_state) {
  case SETUP:
    setup_2();
    break;

  case RADAR:
    radar();
    break;

  case POINTER:
    pointer();
    break;

  case HISTOGRAM:
    histogram();    
    break;

  default:
    //error 
    break;
  }
}

// -----------------------------------------------------------------------

private void setup_2() {
  // some code here 
  _state = State.RADAR;
  println("setup_2");
}

private void radar() {
  //some code here
  print("radar");
  stroke(0); 
  rect(681, 734, 
    90, 100); 
  if (mouseX>681 && 
    mouseX<781 && 
    mouseY>734 && 
    mouseY<856 && 
    mousePressed) {
    _state = State.POINTER;
  }
}

private void pointer() {
  //some code here
  println("pointer");
  if (mouseX>681 && mouseX<771 && mouseY>734 && mouseY<756 && mousePressed) {
    _state = State.HISTOGRAM;
  }
}

private void histogram() {
  //some code here
  if (mouseX>681 && mouseX<771 && mouseY>734 && mouseY<756 && mousePressed) {
    // _state = State.RADAR;
  }
}

```

---

<div class="post-metadata">

**Author:** ![rapatski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rapatski/32/5164_2.png) [@rapatski](https://discourse.processing.org/u/rapatski)\
**Post date:** [July 26, 2019, 1:52pm UTC](https://discourse.processing.org/t/processing-not-recognizing-enum/12899/5 "2019-07-26T13:52:33Z")

</div>

Woah wild! This is actually great news. Love enums 😉
