showing results for - "what is modulus operator"
Axel
05 Nov 2018
1// given a list of widgets, files, people, etc.
2longList = 10000; 
3feedbackInterval = 100; // to be used as the modulus
4
5// loop over the list to process each item
6for( i=1; i <= longList; i++ ) {
7	
8  // perform some operation
9	
10  // mod operation gives feedback once every hundred loops
11  if( i % feedbackInterval == 0 ) {
12    percentCompleted = ( i / longList ) * 100;
13    writeOutput( "#percentCompleted# percent complete. " );
14  }
15	
16}
17