title: Variable does not exist in the current context?
body: <p>I know this is most likely a stupid question but I am a university student who is new to C# and object-oriented programming. I have tried to find the answer elsewhere but I wasn't able to find anything that could help. The debugger keeps telling me that the variable 'cust_num does not exist in the current context'. If someone can tell me what I have done wrong and make me feel like an idiot, I would greatly appreciate it. Thanks!</p>
  
  <pre><code>    string get_cust_num()
      {
          bool cust_num_valid = false;
  
          while (!cust_num_valid)
          {
              cust_num_valid = true;
              Console.Write("Please enter customer number: ");
              string cust_num = Console.ReadLine();
  
              if (cust_num == "000000" || !Regex.IsMatch(cust_num, @"^[0-9]+$") || cust_num.Length != 6)
              {
                  cust_num_valid = false;
                  Console.WriteLine("Invalid customer number detected. Customer numbers must be a 6 digit positive integer (zeros will not work)");
              }
          }
  
          return cust_num;
      }
  </code></pre>