Back to all rules
What this rule checks
Uses the modulo operator
Configuration
When off, this rule is excluded from pipeline runs. Changes apply immediately.
Code Examples
PASS — this code satisfies the rule
void setup() {
  size(400, 400);
}

void draw() {
  if (frameCount % 60 == 0) {  // true once every 60 frames
    background(random(255), 0, 0);
  }
}
FAIL — this code triggers the rule
int timer = 0;

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

void draw() {
  timer = timer + 1;
  if (timer == 60) {  // a counter reset instead of %
    timer = 0;
    background(random(255), 0, 0);
  }
}
Overview
Category Topic Iteration
Level Basic
Type Custom Zita
Priority 3 (1 = highest, 5 = lowest)
Status Active
PMD Configuration
Java class nl.utwente.processing.pmd.rules.HasModuloOperatorRule
Message template Program uses the modulo operator (%).