Back to all rules
What this rule checks
Uses && or || somewhere in the sketch (not necessarily in an if condition; ! does not count)
Configuration
When off, this rule is excluded from pipeline runs. Changes apply immediately.
Code Examples
PASS — this code satisfies the rule
float x = 200;
float speed = 3;

void setup() {
  size(400, 400);
}

void draw() {
  background(255);
  x = x + speed;
  if (x > width || x < 0) {
    speed = -speed;
  }
  ellipse(x, 200, 20, 20);
}
FAIL — this code triggers the rule
float x = 200;
float speed = 3;

void setup() {
  size(400, 400);
}

void draw() {
  background(255);
  x = x + speed;
  if (x > width) {  // two ifs where || would join them
    speed = -speed;
  }
  if (x < 0) {
    speed = -speed;
  }
  ellipse(x, 200, 20, 20);
}
Overview
Category Topic Conditionals
Level Basic
Type Custom Zita
Priority 3 (1 = highest, 5 = lowest)
Status Active
PMD Configuration
Java class nl.utwente.processing.pmd.rules.HasNoBooleanOperatorRule
Message template No boolean operator found in the program.