Iteration SCLM

Smaller Programs/Less Code

     Iteration provides us with all of the before mentioned benefits that it essentially translates to code by reducing the overall amount of lines needed to solve a problem.  For Example:

system.out(1);//output 1                //Conditioning Loop

system.out(2);//output 2                for(int i=1; i<=50; i++)

system.out(3);//output 3                {//loop will run 50 times

...//output of 4-49                         system.out(i);//outputs i

system.out(50);//output 50              }//end of loop

Total: 50 Lines                         2 lines

There is a drastic change in code length even with a relatively simple program.


PreviousNext

Previous Table of Contents Next