"While" Blocks test

Hi!
Can someone perform the results shown below?
Loop

You should use “if” instead of “while”…

2 Likes

Infinite loop - the name variable is not increasing the value, so it will cause an infinity loop and may give an Stack Size: 8MB error

5 Likes

How to use blocks to display the following code

  int i = 1; 
  while( i==1 ){ 
      System.out.println("Hello"); 
      i=0; 
  }

Just rewrite with blocks.

image

4 Likes