0

for loop and while(true), which is better ?

I have a search method and there are two way to implement it one is for loop and one is while(true), both are terminate and throw IndexOutOfException. Therefore, what is better ?

27th Aug 2019, 7:50 AM
Ha Nguyen
Ha Nguyen - avatar
2 odpowiedzi
0
this exception is not depend of ( for vs while.) choice. for is preferable if you need counter
27th Aug 2019, 11:21 PM
zemiak
0
It is a exercise in exception topic
27th Aug 2019, 11:42 PM
Ha Nguyen
Ha Nguyen - avatar