title: How would I skip spaces in a foreach loop?
body: <p>C# newbie here. </p>
  
  <p>I am using a foreach statement to loop through a string of characters and write numerical values to an <strong>int</strong> based on their position in the alphabet. </p>
  
  <p>This is working correctly but it throws this error when I attempt to skip spaces in the string:</p>
  
  <blockquote>
    <p>Cannot assign to "c" because it is a foreach iteration variable.</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>foreach (char c in encodedText)
  {
      if (c = " ");
      {
          continue;
      }
  
      int index = char.ToUpper(c) - 64;
      Console.WriteLine(index);
  }
  </code></pre>