05-05-2023, 01:35 AM
It's a matter of legibility more than logic flow. The more nested if...thens the harder it will be to track the if...efseif...thens as the code grows in complexity.
Code: (Select All)
x = 3: y = 5
'this block is easier to read
If x > 5 Then
Print "x"; x
Else
If y > 2 Then
Print "Y"; y
Else
Print "X+Y"; x + y
End If
End If
'this block isn't as easy to read but will produce the same results as the one above
If x > 5 Then
Print "x"; x
ElseIf y > 2 Then
Print "Y"; y
Else
Print "X+Y"; x + y
End If