Skip to main content

11.3) Conditional Logic And Relational Statements


  • Conditional logic is the use of true and false statements
  • Logicals are a data type whose values are true (1) or false (0) and are of the Boolean class
  • Logical expression are either right or wrong
  • Relational operations make the comparison. The main ones are:
  • == Is equal to
    > Is greater than
    < Is less than
    ~= Is not equal to
    >= Is greater than or equal to
    <= Is less than or equal to
  • Thinking in terms of numbers, the basic comparison is like "is 3 less than 4", "is 9 greater than 11" and "is 4 equal to 2+2"
  • Relation statements (a>b) result in a logical expression (1 or 0)
  • Relational statements can be combined with the following logical operators
  • & and
    | or
  • For clarity, relational statements are best enclosed in parenthesis