March 9, 200421 yr Once upon a time I remember reading somewhere that one should always include the ELSE statement in your If / End If even if you don't need it because FileMaker will run the script faster if you do. Here's an example of what I mean: If ["MyName = "Ted""] Show Message ["Hello Ted"] End If This is what I have seen recommended in the past: If ["MyName = "Ted""] Show Message ["Hello Ted"] Else End If Does the ELSE actually speed things up? I personally haven't noticed any difference. Version: v6.x Platform: Windows XP
March 10, 200421 yr I did a quick speed test using a loop with 10 if-then else vs if-then. The loop without the else took 2:06 the loop with the else took 2:17. The else added 11 seconds, about 8% to the time of this loop. I had heard this years ago, there is no fundemental reason the else will make things faster, it must have been inefficient coding inside of FileMaker. In normal programming languages (and FM6), the else slows things down even if nothing is executed (in good languages an optimizing compiler would notice that the else does nothing and it wouldn't add any code for it).
March 10, 200421 yr I thought the Else statement was Good Programming Practice, needed to avoid 'dead end' programming, which, alledgedly, is an abbhoration in the eyes of the Coder?
March 10, 200421 yr The "Else" statement became part of programming languages years ago in order to get rid of the Goto statement which was a primary contributor to bad program design. But, that doesn't mean you need to use it all the time.
Create an account or sign in to comment