Ted S Posted March 9, 2004 Posted March 9, 2004 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
CyborgSam Posted March 10, 2004 Posted March 10, 2004 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).
Ano Nimus Posted March 10, 2004 Posted March 10, 2004 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?
BobWeaver Posted March 10, 2004 Posted March 10, 2004 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.
Recommended Posts
This topic is 7566 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now