# Difference between revisions of "OR (boolean)"

Jump to navigation
Jump to search

imported>Clippy m |
imported>Clippy m |
||

Line 1: | Line 1: | ||

The '''OR''' coditional operator adds an alternative in a [[IF...THEN]] or [[Boolean]] statement. | The '''OR''' coditional operator adds an alternative in a [[IF...THEN]] or [[Boolean]] statement. | ||

+ | |||

+ | {{PageSyntax}} | ||

+ | :: IF a = 1 '''OR''' a = 2 THEN a = 0 | ||

* OR adds an alternative to another conditional evaluation. IF True then the statement evaluation is True. | * OR adds an alternative to another conditional evaluation. IF True then the statement evaluation is True. | ||

− | * Parenthesis may be used to clarify an evaluation. | + | * Parenthesis may be used to clarify the order of comparisons in an evaluation. |

+ | * '''An OR OR statement will create a QB64 compiler error!''' | ||

* Can be confused with the [[OR]] numerical operator. | * Can be confused with the [[OR]] numerical operator. | ||

## Revision as of 00:20, 7 August 2013

The **OR** coditional operator adds an alternative in a IF...THEN or Boolean statement.

## Syntax

- IF a = 1
**OR**a = 2 THEN a = 0

- IF a = 1

- OR adds an alternative to another conditional evaluation. IF True then the statement evaluation is True.
- Parenthesis may be used to clarify the order of comparisons in an evaluation.
**An OR OR statement will create a QB64 compiler error!**- Can be confused with the OR numerical operator.

**Relational Operators:**

Symbol | Condition | Example Usage |
---|---|---|

< | Less than | IF a < b THEN |

> | Greater than | IF a > b THEN |

= | Equal | IF a = b THEN |

<= | Less than or equal | IF a <= b THEN |

>= | Greater than or equal | IF a >= b THEN |

<> | NOT equal | IF a <> b THEN |

*Example:*

a% = 100 b% = 50 IF (a% > b% AND a% < 100) OR b% = 50 THEN PRINT "True"

True

*Explanation:*The first evaluation was False, but the OR evaluation made the statement true and the code was executed.

*See also:*

*Navigation:*