How do I convert this for loop into a while loop? [closed]
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I am creating an array program. I am practicing how to convert for loops to while loops, but I cannot grasp the concept. If I have the for loop: int [] list = new int [5]; for (int i = 0; i < 5; i++) { list [i] = i + 2; } How would I make it a while loop? Here's my attempt int [] list = new int [5]; int i = 0;