Changes

Jump to navigation Jump to search
10 bytes added ,  02:18, February 22, 2009
no edit summary
Line 1: Line 1: −
A '''loop''' in [[Computer Programming]] is a section of instructions which are repeated - either endlessly or until a certain expected state occurs.
+
A '''loop''' in [[computer programming]] is a section of instructions which are repeated - either endlessly or until a certain expected state occurs.
 
A common error made by novice programmers is to program an infinite loop, i.e., one that never ends despite the programmer's hopes.
 
A common error made by novice programmers is to program an infinite loop, i.e., one that never ends despite the programmer's hopes.
   Line 19: Line 19:  
A while loop doesn't need a counter:
 
A while loop doesn't need a counter:
   −
  while ( boxes.getCount() > 0 ) {
+
  while ( shipment.hasItems() > 0 ) {
 
   
 
   
   Item box = boxes.getFirst();
+
   Item box = shipment.getFirst();
 
   box.shipToCustomer();
 
   box.shipToCustomer();
 
   
 
   
   boxes.remove(box);
+
   shipment.remove(box);
 
   
 
   
 
  }
 
  }
Line 34: Line 34:  
   queue.printStatus();
 
   queue.printStatus();
 
   queue.processFirstItem();
 
   queue.processFirstItem();
 
+
 
  } while (queue.hasItems());
 
  } while (queue.hasItems());
    
[[Category:Computer Programming]]
 
[[Category:Computer Programming]]
2,851

edits

Navigation menu