Question: I have hit another obstacle in my attempt to create a shape calculator and this time it's using a Loop with my Switch/Case statements allowing the user to select the shapes they wish to calculate.

I am trying to make my Calculator like this. User selects 1 for Triangle, they calculate that and say they now wish to select 5 to calculate a Circle right after, then do another circle calculation again and for however many times they wish and then be able to move onto another shape. Say 6 for a sphere.

So far I've tried using a While (True) loop but it seems once I have made a selection I get stuck in that case and can't go on to select another shape to calculate or select the case that closes/exits the program.

I've reduced my program to an example below cutting out the code needed to make a shapes as the shapes themselves are not the program here. It's trying to make my users range of choice flexible I guess you could say.

```js
Scanner scan = new Scanner(System.in); //take user input

int decision = scan.nextInt();

loop: while (true) {
  switch (decision) { 
    case 1:
      //example
      break;
    case 2:
      //example and so on
      break;
    case 3:
      break;
    case 9:
      // Quit
      System.out.println("You decided to Quit");
      break loop;
    default:
      // Wrong decision
      System.out.println("Select a number between 1 and 8 to make a decision or 9 to Quit");
  }
  //exit program code here
}
```

Answer: 
Move the `scan.nextInt()` inside the loop

```
loop: while (true) {
  int decision = scan.nextInt();

  switch (decision) { 
    case 1:
      //example
      break;
    case 2:
      //example and so on
      break;
    case 3:
      break;
    case 9:
      // Quit
      System.out.println("You decided to Quit");
      break loop;
    default:
      // Wrong decision
      System.out.println("Select a number between 1 and 8 to make a decision or 9 to Quit");
  }
  //exit program code here
}

```
**Problem:**
You are taking decision input only once, since it is written outside the infinite while loop. Therefore during execution of infinite loop, decision will never change and every time same case will get executed, giving an impression that program is stuck within a case, which is not the case any ways.

**Solution:** Move the input statement withing infinite while loop.

```
while (true) {
int decision = scan.nextInt();
//rest of the code 
....
....
}

```