# Breaking out of two loops

Everything is finished but I have to add code for the user to be able to quit from any of the inputs. However, I can't break out of the loop as it would just break the innermost loop and continue looping inputs from the outer loop. Possibly I could make a function for this and use a return statement, but as it hasn't been introduced in the course yet, I'm trying to avoid it to figure out another solution. Here's my code:

```using System;

namespace Arithmetic
{
class MainClass
{
public static void Main (string[] args)
{
var number1 = 0.0;
var number2 = 0.0;
var result = 0.0;
var operation = "";

// keep everything running until user inputs quit
while (true) {
// Keep prompting until user inputs a valid number
while (true) {

if (str == "quit")
// do something

try {
number1 = double.Parse (str);
break;
} catch (FormatException) {
Console.WriteLine ("Invalid number try again!");
continue;
}
}

// Keep prompting until user inputs a valid operation
while (true) {
Console.Write ("What arithmetic operation would you like to do? +-/*^   : ");

if ((operation == "+") || (operation == "-") || (operation == "^") ||
(operation == "/") || (operation == "*")) {
break;
} else if (operation == "quit")
// do something
else
continue;
}

// Keep prompting until user inputs a valid number
while (true) {

if (str == "quit")
// do something

try {
number2 = double.Parse (str);
break;
} catch (FormatException) {
Console.WriteLine ("Invalid number try again!");
continue;
}
}

// do arithmetic calculations
if (operation == "+")
result = number1 + number2;
else if (operation == "-")
result = number1 - number2;
else if (operation == "/")
result = number1 / number2;
else if (operation == "*")
result = number1 * number2;
else if (operation == "^")
result = Math.Pow (number1, number2);

Console.WriteLine ("Your result is: " + result);
}
}
}
}
``` ```//Prompt the user for a number.