FAQ
 
 
Cover  \ Exhibition  \ Learning  \ Reference  \ Download  \ Discourse   
      Language \ Environment \ Libraries \ Comparison
 
   
   
Abridged (A-Z) \ Complete (A-Z)  
   
  Reference for Processing (BETA) version 91+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.  
Name  

% (modulo)

   
Examples  
int a = 20%100;         // Sets a to 20 
int b = 20%100;         // Sets b to 20 
float c = 75.0%100.0;   // Sets c to 75.0 
float d = 275.0%100.0;  // Sets d to 75.0 


float a = 0.0; 
void draw() { 
  background(204); 
  a = (a + 0.5)%width; 
  line(a, 0, a, height); 
} 

Description   Calculates the remainer when one number is divided by another. It is extremely useful for keeping numbers within a boundary such as keeping a shape on the screen.
   
Syntax  
value1%value2
   
Parameters  
value1   int or float

value2   int or float

   
Returns   int or float
   
Usage   Web & Application
   
Related   / (divide)
 
 






   
 
Updated: Fri Jul 15 16:35:48 PDT 2005
 
 








Creative Commons License
 
  Processing is an open project initiated by Ben Fry and Casey Reas  
  © Info