I am making a scenario that displays dots. i would like to compact having several while loops to just having one to add the dots.


1 2 3 4 5 | while (addeddots != numdots) { addeddots ++; addObject( new Dot( 5 ), ((addeddots- 119 ) * 5 ) - 1 , 5 ); } |
1 2 3 4 5 | while (addeddots != numdots && addeddots >= 119 ) { addeddots ++; addObject( new Dot( 5 ), ((addeddots- 119 ) * 5 ) - 1 , 11 ); } |
1 2 3 4 5 | while (addeddots != numdots && addeddots >= 238 ) { addeddots ++; addObject( new Dot( 5 ), ((addeddots- 238 ) * 5 ) - 1 , 17 ); } |
1 2 3 4 5 | for ( int myCt = 0 ; myCt < 119 ; myCt++) { addObject( new Dot( 5 ), myCt * 5 + 4 , 5 ); addObject( new Dot( 5 ), myCt * 5 + 4 , 11 ); addObject( new Dot( 5 ), myCt * 5 + 4 , 17 ); } |