For Casio Graphic Calculators 9750/9850/9950 and compatibles

This page is from the CGCE by Tom Lynn.

Logical Expressions

The 9x50 models handle boolean logic slightly differently to the older models.

For example, the statement

  I = 3 => Goto 5
would be handled as follows:

     Pre-9x50s                   9x50s

     I = 3 => Goto 5             I = 3 => Goto 5
     (I) = (3) => (Goto 5)       (I = 3) => (Goto 5)
     (Goto 5)                    (1) => (Goto 5)
                                 (Goto 5)
The difference is that on older models the relational operators (=, <, >, <=, >=, <>) were considered to be syntactic breakpoints, part of the conditional statement format. To test whether or not to carry out the Goto 5 they simply tested whether I = 3.

On 9x50s though, every expression which includes a relational operator is assigned a value of either 0 or 1 when it is evaluated (0 = FALSE, 1 = TRUE). A condition is then carried out as long as the entire expression which precedes the => is non-zero. So on a 9x50, this is legal code:

  123.456 => "WIBBLE"

Uses of boolean expressions

With these extended boolean expressions it becomes possible to use some clever tricks to shorten your code. For example, this code
  X = 3 => 20 -> Y
  X <> 3 => 50 -> Y
can be converted to
  50 - 30(X=3) -> Y
You can also put a number of boolean expressions together. For example, instead of using
  If ((X > 30) And (Y < 20))
  Then X + 27 -> Y
  IfEnd;
you can use
  X + 27(X > 30)(Y < 20) -> Y

You can shorten expressions by using the logical similarities between " And " and " Or " and multiplication and addition. For example, instead of:

  ((X = 1) And (X-3 > B)) Or (Y=2) => Goto 5
you can use
  (X = 1)(X-3 > B) + (Y = 2) => Goto 5

For a number of more advanced examples, see lists.html.