Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

If...End If or Else If

Featured Replies

Could someone tell me if it is better to use a series of If...End If or a series of Else If.

Expl: what’s better: Script1 or Script2

Script1

IF [Amount = 100]

Do 1

End IF

IF [Amount = 200]

Do 2

End IF

IF [Amount = 300]

Do 3

End IF

Script2

IF [Amount = 100]

Do 1

ELSE IF [Amount = 200]

Do 2

ELSE IF [Amount = 300]

Do 3

End IF

Thanks

They behave differently, and depending on context one or the other might be best.

In the first example, the subsequent If [] End If [] blocks will still evaluate regardless of whether the first returns true. Which might be what you want if "Do 1" were to add some number to Amount that you want to perform further evaluations on. In this particular case it won't, but it's important to make the distinction.

If [] Else If [] Else [] End If []is useful when only one If [] block should be executed.

In your example, the second one is better, because in the first script it has to evaluate the 2nd and 3rd IF, whereas in the second script there's no wasted evaluation.

However, if the first script looked like the following, then I'd say there's no real difference:

IF [Amount = 100]

Do 1

Exit Script

End IF

IF [Amount = 200]

Do 2

Exit Script

End IF

IF [Amount = 300]

Do 3

Exit Script

End IF

  • Author

Thanks guys; it see the difference now.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.