Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've decompiled the two and it seem to be generating the same code (using ildasm). This is a very simple If statment, might get different result for different If. I would suggest you do the same with your code and see.</p> <pre><code>Module Module1 Sub Main() Dim a As Integer Dim i As Integer = 1 If i = 1 Then a = 9 ElseIf i = 2 Then a = 8 ElseIf i = 3 Then a = 7 Else a = 6 End If End Sub End Module .method public static void Main() cil managed { .entrypoint .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00 00 ) // Code size 30 (0x1e) .maxstack 2 .locals init ([0] int32 a, [1] int32 i) IL_0000: ldc.i4.1 IL_0001: stloc.1 IL_0002: ldloc.1 IL_0003: ldc.i4.1 IL_0004: bne.un.s IL_000b IL_0006: ldc.i4.s 9 IL_0008: stloc.0 IL_0009: br.s IL_001d IL_000b: ldloc.1 IL_000c: ldc.i4.2 IL_000d: bne.un.s IL_0013 IL_000f: ldc.i4.8 IL_0010: stloc.0 IL_0011: br.s IL_001d IL_0013: ldloc.1 IL_0014: ldc.i4.3 IL_0015: bne.un.s IL_001b IL_0017: ldc.i4.7 IL_0018: stloc.0 IL_0019: br.s IL_001d IL_001b: ldc.i4.6 IL_001c: stloc.0 IL_001d: ret } // end of method Module1::Main </code></pre> <p>And the other one</p> <pre><code>Module Module1 Sub Main() Dim a As Integer Dim i As Integer = 1 If i = 1 Then a = 9 Else If i = 2 Then a = 8 Else If i = 3 Then a = 7 Else a = 6 End If End If End If End Sub End Module .method public static void Main() cil managed { .entrypoint .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00 00 ) // Code size 30 (0x1e) .maxstack 2 .locals init ([0] int32 a, [1] int32 i) IL_0000: ldc.i4.1 IL_0001: stloc.1 IL_0002: ldloc.1 IL_0003: ldc.i4.1 IL_0004: bne.un.s IL_000b IL_0006: ldc.i4.s 9 IL_0008: stloc.0 IL_0009: br.s IL_001d IL_000b: ldloc.1 IL_000c: ldc.i4.2 IL_000d: bne.un.s IL_0013 IL_000f: ldc.i4.8 IL_0010: stloc.0 IL_0011: br.s IL_001d IL_0013: ldloc.1 IL_0014: ldc.i4.3 IL_0015: bne.un.s IL_001b IL_0017: ldc.i4.7 IL_0018: stloc.0 IL_0019: br.s IL_001d IL_001b: ldc.i4.6 IL_001c: stloc.0 IL_001d: ret } // end of method Module1::Main </code></pre> <p>I would suggest to use the one that is easier to read.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload