Previous Topic

Next Topic

Book Contents

Book Index

Sample expressions that use operators

The following simple rule expressions show how to use operators in rule expressions.

Sample expressions that use operators

Example:

Expression:

x is greater than y

x > y

x is less than or equal to z

x <= z

x is greater than y and x is less than or equal to z

(x > y) && (x <= z)

x is greater than y or x is less than or equal to z

(x > y) || (x <= z)

x is equal to 3 or x is equal to 6.4

(x = =3) || (x = =6.4)

x is not more than ten percent greater than y

x <= y*1.1

!(x>y*1.1)

If x is greater than y, then value is 100, else value is 200.

x>y?100:200

If x is not greater than y, then check if y is greater than z. Otherwise, return false.

!(x>y)?y>z:false

x>y?false:y>z

x<=y?y>z:false

Copyright © 2013, 2016 Oracle and/or its affiliates. All rights reserved.