wonder Expert Licensed User Longtime User Dec 3, 2015 #1 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
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
MikeH Well-Known Member Licensed User Longtime User Dec 3, 2015 #2 I dont think so but why not just: Code: Copy Return Condition Upvote 0
wonder Expert Licensed User Longtime User Dec 3, 2015 #3 MikeH said: I dont think so but why not just: Code: Copy Return Condition Click to expand... Brilliant and elegant!! Upvote 0
MikeH said: I dont think so but why not just: Code: Copy Return Condition Click to expand... Brilliant and elegant!!
S sorex Expert Licensed User Longtime User Dec 3, 2015 #4 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
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.