Jump to content

Else?


This topic is 6734 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

This topic is 6734 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.