Language \ Environment \ Comparison
 
Index
 
  The Processing 1.0 _ALPHA_ Reference is a work in progress.
If you see any errors or have any comments, please write to: reas at groupc.net
Name  

% (modulo)

   
Examples  
int a = 20%100;   // Sets a to 20 
int b = 20%100;   // Sets b to 20 
int c = 75%100;   // Sets c to 75 
int d = 275%100;  // Sets d to 75 


float a = 0.0; 
void loop() { 
  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

value2   int

   
Usage   Web & Application
   
Related   / (divide)
   
© 2004 - 2001 Massachusetts Institute of Technology and Interaction Design Institute Ivrea
Processing is an open project initiated by Ben Fry and Casey Reas