title: Returning back to the beginning of a block of code?
body: <p>I need to return back to the beginning of the code shown here after a user enters the wrong key.  Is there any simple line of code that will just return back to another line?  As you can see I already have an if statement set up so I can just add something that can return back to the beginning or to another area in my code.  I am really quite new to c# and programming in general.  I really just don't want to have to enter all the code again into another if statement that would produce the same issue.  I would preferably like to have the code just run again after a user enters a wrong key, because then they can re-read it without having to start from scratch again.</p>
  
  <pre><code>//Runs battle interactive
  Console.WriteLine("");
  Console.WriteLine("You have encountered a simple guard!  He deals 2 damage per attack and has 1 HP.");
  Console.WriteLine("You currently have: " + Program.Inventory);
  Console.WriteLine("Choose a weapon!");
  var input2 = Console.ReadKey();
  
  
  //Key checker for items
  switch (input2.Key)
  {
      case ConsoleKey.D1:
          Console.WriteLine("");
          if (Items.iniFists == true)
          {
              Console.WriteLine("You have attacked with your Fists for 1 DMG!");
          }
          else
          {
              //this will never run, just a placeholder
              Console.WriteLine("You Don't have your fists!");
              switch (input2.Key)
              {
                  case ConsoleKey.D1:
                      Console.WriteLine("");
                      if (Items.iniFists == true)
                      {
                          Console.WriteLine("You have attacked with your Fists for 1 DMG!");
                      }
                      else
                      {
                          //this will never run, just a placeholder
                          Console.WriteLine("You Don't have your fists!");
                      }
                      break;
                  case ConsoleKey.D2:
                      Console.WriteLine("");
                      if (Items.iniLongsword == true)
                      {
                          Console.WriteLine("You have chosen to attack with the Longsword for 2 DMG!");
                      }
                      else
                      {
                          Console.WriteLine("You don't have a longsword!");
                      }
                      break;
                  case ConsoleKey.D3:
                      Console.WriteLine("");
                      if (Items.iniBow == true)
                      {
                          Console.WriteLine("You have chosen to attack with the Bow for 3 DMG!");
                      }
                      else
                      {
                          Console.WriteLine("You don't have a Bow!");
                      }
                      break;
                  case ConsoleKey.D4:
                      Console.WriteLine("");
                      if (Items.iniLightstaff == true)
                      {
                          Console.WriteLine("You have chosen to attack with the Lightstaff for 4 DMG!");
                      }
                      else
                      {
                          Console.WriteLine("You don't have a Lightstaff!");
                      }
                      break;
                  case ConsoleKey.D5:
                      Console.WriteLine("");
                      Console.WriteLine("You can't attack with an Apple!");
                      break;
                  case ConsoleKey.D6:
                      Console.WriteLine("");
                      Console.WriteLine("You can't attack with a Golden Key!");
                      break;
                  case ConsoleKey.D7:
                      Console.WriteLine("");
                      Console.WriteLine("You can't attack with a Steak!");
                      break;
              }
          }
          break;
      case ConsoleKey.D2:
          Console.WriteLine("");
          if (Items.iniLongsword == true)
          {
              Console.WriteLine("You have chosen to attack with the Longsword for 2 DMG!");
          }
          else
          {
              Console.WriteLine("You don't have a longsword!");
          }
          break;
      case ConsoleKey.D3:
          Console.WriteLine("");
          if (Items.iniBow == true)
          {
              Console.WriteLine("You have chosen to attack with the Bow for 3 DMG!");
          }
          else
          {
              Console.WriteLine("You don't have a Bow!");
          }
          break;
      case ConsoleKey.D4:
          Console.WriteLine("");
          if (Items.iniLightstaff == true)
          {
              Console.WriteLine("You have chosen to attack with the Lightstaff for 4 DMG!");
          }
          else
          {
              Console.WriteLine("You don't have a Lightstaff!");
          }
          break;
      case ConsoleKey.D5:
          Console.WriteLine("");
          Console.WriteLine("You can't attack with an Apple!");
          break;
      case ConsoleKey.D6:
          Console.WriteLine("");
          Console.WriteLine("You can't attack with a Golden Key!");
          break;
      case ConsoleKey.D7:
          Console.WriteLine("");
          Console.WriteLine("You can't attack with a Steak!");
          break;
  }
  </code></pre>