reset password
Author Message
rlamdja
Posts: 12
Posted 19:40 Jan 25, 2018 |

Sorry I'm still new to Java, so what is it really mean when the hint said no loop needed?

kcrespi
Posts: 12
Posted 20:11 Jan 25, 2018 |

Looping is used to repeat a set of instructions/functions.

If you required to print all the set of numbers from 1 to 100,000.

You would notmally print the numbers as a String, which means that you will type all the numbers 

System.out.print(“1,2,4,5,6,7,8,9,10,11,12...100000”);

 

However, with a loop, it is simply as...

for (int i = 0, i < 100000, i++) {

System.out.print(i + “, “);

}

 

So, when it say “not loop required”, means that the information is managable, and you can type/“hard code” the pogram without using a loop.

You will learn it later on. 

Last edited by kcrespi at 20:12 Jan 25, 2018.
rlamdja
Posts: 12
Posted 20:24 Jan 25, 2018 |

okay, I got it now. Thank you very much. 

kknaur
Posts: 540
Posted 08:47 Jan 26, 2018 |

This is correct.  We will study loops much much later.  This week is all about getting basic programs working, learning the compiling process and working with simple print statements and simple computations.