Does the iif() function runs faster than if .. else block?

Does anyone knows if under the hood using the iif () function pointer would results in faster code compilation than the regular if ... else block and that whenever possible we should use iif () instead, not only for faster code but cleaner ? thanks.

It is NOT about the speed.

IIF() is fundamentally different than if-else.

  • IIF() is a function (like MA(), EMA(), Plot()) - it does NOT change program flow. All arguments of functions are always evaluated.

  • if-else on the other hand is a program control statement. It changes program flow. It allows some parts of the code to be skipped (NOT executed).

Search the forum before posting, as it is all explained already in detail:

5 Likes

Duplicate exists: IIf function versus if statement