title: Nested inline if statement
body: <p>In VB .Net it is possible to use inline <code>If</code> statements, like this</p>
  
  <pre><code>if a Then ret = "A" Else ret = "Not A"
  </code></pre>
  
  <p>I know it is also possible to nest these statements. I know this might not be good practice as readability drops down...</p>
  
  <pre><code>If a Then If b Then ret = "A &amp; B" Else ret = "A &amp; Not B" Else ret = "Not A"
  </code></pre>
  
  <p>which will be evaluated like this :</p>
  
  <pre><code>If a Then
      If b Then
          ret = "A &amp; B"
      Else
          ret = "A &amp; Not B"
      End If
  Else
      ret = "Not A"
  End If
  </code></pre>
  
  <p>Now if I remove the last <code>Else</code> statement, I get this :</p>
  
  <pre><code>If a Then If b Then ret = "A &amp; B" Else ret = "A &amp; Not B"
  </code></pre>
  
  <p>which is :</p>
  
  <pre><code>If a Then
      If b Then
          ret = "A &amp; B"
      Else
          ret = "A &amp; Not B"
      End If
  End If
  </code></pre>
  
  <p>So I guess the compiler finds the <code>Else</code> and matches it to the last openend <code>If</code> in the line, which makes sense.
  My question is : Is it possible to change the evaluation order ? By that I mean is it possible that the Else is matched with the first if ?</p>
  
  <p>So it would look like this :</p>
  
  <pre><code>If a Then
      If b Then
          ret = "A &amp; B"
      End If
  Else
      ret = "Not A"
  End If
  </code></pre>
  
  <p>But inlined (something like this, parenthesis added to understand what I mean) :</p>
  
  <pre><code>If a Then ( If b Then ret = "A &amp; B" ) Else ret = "Not A"
  </code></pre>
  
  <p>I tried with parenthesis or adding a <code>End If</code> but it provokes syntax errors, and I couldn't find documentation for this.</p>
  
  <p>I'm not stuck anywhere and I know this might not be a good prorgamming practice, but I just wanted to know (out of curiosity) if it was possible.</p>
  
  <p>I know also I could switch the statements (i.e. test b before a), but let's say I can't (a is a List and must be tested for Nothing before b which would be the Count for example).</p>