Mixing 'active' and 'static' modes.

This is static mode, all the code is outside of methods:

int s = 10;
println(s);

This is active mode, there are setup() and draw() methods. There is no code outside these methods.

int a;

void setup() {
  a = 10;
  noLoop();
}

void draw() {
  println(a);
}

If you have setup() and draw() AND code outside of setup() and draw() you'll get the 'Mixing...' error message. This is often because you're calling a method whilst defining variables at the top of the file so look there first. Or you've too many closing }s on one of your methods - try ctrl-t to indent.

Comments

  • This will give you the error:

    int a;
    
    void setup() {
      a = 10;
      noLoop();
    }
    
    println(a); // this is outside of any method
    
Sign In or Register to comment.