What is the difference between OR and ORELSE ? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

What is the difference between OR and ORELSE ?

kishore_peddikishore_peddi Posts: 176Member


Please let me know

what is the difference between OR and ORELSE ?
What is the difference between AND and ANDALSO ?



  • kainsworthkainsworth Posts: 200Member
    ORELSE is a short-circuit version of OR.

    If you use OR, then both Expression1 and Expression2 will be evaluated. If either is True then the Result is True.
    However, if you use ORELSE and Expression1 is found to be True then Expression2 is not evaluated.

    The same applies to AND and ANDALSO, the latter being the short circuit version. If the first test returns True then the second expression is not evaluated.

    The AND and the OR logical operators always evaluate BOTH expressions regardless of the value of the first expression. (I'm not entirely sure why, but I do know that this is the case.)

    The inclusion of the short circuit versions allow developers to place the expression which runs fastest as Expression1 and if it results in not needing to call Expression2 (which takes longer) then there is a performance increase.

Sign In or Register to comment.