Skip to content

Boolean short-circuiting versions of AND and OR #211

Closed
@a740g

Description

@a740g

We need Boolean short-circuit evaluation versions of AND and OR.
VB, FreeBASIC and many other languages use the AndAlso and OrElse keywords.
This can be implemented in QB64 using _ANDALSO and _ORELSE keywords.

IF x = 0 _ORELSE y = 0 THEN
...
END IF
IF x = 0 _ANDALSO y = 0 THEN
...
END IF

@mkilgore also noted that AND and OR in QB64 are not logical operators. So, _ANDALSO and _ORELSE keywords can be implemented as logical Boolean short-circuit evaluation versions of AND and OR. Apparently, NOT is also not logical which can lead to surprising situations (ex. NOT 1 does not give a false value). So, we may need a logical version of NOT as well (ex. _LNOT)

See Logical and Bitwise Operators in Visual Basic for a more in-depth discussion on logical and bitwise operators.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions