Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8749473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:42:02+00:00 2026-06-13T12:42:02+00:00

Is there a performance advantage to using IIf over If ? Other than simply

  • 0

Is there a performance advantage to using IIf over If?

Other than simply less code… what is the difference between :

If msInitialFloodSection <> Trim$(cboFloodSection.Text) Then
    mbFloodSectionChanged = True
Else
    mbFloodSectionChanged = False
End If

and

mbFloodSectionChanged = IIf(msInitialFloodSection <> Trim$(cboFloodSection.Text), True, False)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:42:03+00:00Added an answer on June 13, 2026 at 12:42 pm

    IIf is not an operator or a language construct, it’s a function, just like any other function such as Left. It will therefore evaluate all its arguments at all times, whereas with If you will only evaluate the correct branch.

    Example:

    denominator = 0
    value = IIf(denominator = 0, 0, value / denominator)
    

    This will raise Divizion by zero error despite a separate branch exists for denominator being zero.

    Regarding performance, what it will do is packing your values into Variants which will require additional ticks, not that much at all, but if we’re on performance, then If will be faster because it wouldn’t coerce things through Variants and because it will only calculate one of the values, not two.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In writing Win32 C/C++ code, is there any advantage (e.g. performance?) in using Windows-specific
I'm wondering if there is any particular performance advantage in using LIKE over NOT
Is there any performance advantage to using lists over dictionaries over tuples in Python?
Is there any performance benefits to using Command objects to validate constraints over using
Is there a performance difference between the following 2 queries, and if so, then
Is there any performance difference between: p { margin:0px; padding:0px; } and omitting the
Is there any performance advantage of using content type application/json sending an object serialized
Is there any performance advantage to be had when using template parameters with static
Is there a performance advantage to using enum in situations where there are only
Is there any advantage to using a multicast group to send messages rather than

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.