-
Notifications
You must be signed in to change notification settings - Fork 12
Data Types
Hope provides the following data types:
This is equivalent to java Number
class and can be used to hold an int, long or double value. Hope always uses double for internal calculations and matching.
2 + 3 == 5
3.0 > 1
All numbers with dots outside of quotes are parsed to number on both LHS and RHS of an expression.
The following operators can be used to compare with a number:
==, !=, >, >=, <, <=
The following functions can be used to operate on numbers:
- math.add(...)
- math.sub(lhs, rhs)
- math.prod(...)
- math.div(lhs, rhs)
- math.mod(lhs, rhs)
- math.floor(val)
- math.ceil(val)
- math.abs(val)
- math. neg(val)
This is equivalent to the java Boolean
class and represents a logical true or false value.
true != FALSE
true
or false
without quotes ignoring case
The following operators can be used to compare with a boolean:
==, !=
The following !
unary operator can be used exclusively with boolean type only.
true == !false
This is equivalent to a java String
object and is used to represent strings in expressions.
str.len('Hello') == 5
'Something' != 'Nothing'
Quoted alphanumeric sequence of characters containing punctuations can be used to represent strings on both LHS and RHS.
The following operators can be used to compare with strings:
==
!=
The following functions can be used to operate on strings:
- str.len
- str.lower
- str.upper
- str.substr
Object class is used to represent an evaluated Json node. It cannot be provided by an user as a part of an expression and is created only during evaluation time from provided Json.