Android Question If then else structure

wonder

Expert
Licensed User
Longtime User
Is there any difference between the following?

Option 1:
Code: Copy
Sub Something as Boolean
    If Condition Then
        Return True
    Else
        Return False
    End If
End Sub

Option 2:
Code: Copy
Sub Something as Boolean
    If Condition Then Return True
    Return False
End Sub
 
I dont think so but why not just:

Code: Copy
Return Condition
 
Upvote 0
it will compile to the same code because thanks to our fast processor they can do better optimizing which follows/tracks code paths.

it "sees" that both cases end with a return so it will generate example2 for both. I believe they even trash the commands after the if/then as they will never be used/reached.
 
Upvote 0
Back
Top