Simkin supports the following expression types:
Type | Description | Example |
---|---|---|
literal | a literal value of one of the built-in data types | "Simon" , 100 |
self | a reference to the object owning the method | anotherObject.register(self) |
null | an object meaning "nothing" | if (node=null) |
identifier | this is the name of a variable or method, see below for scoping rules | MyVariable |
indirection | you can prepend the identifier with @ to provide indirection | @MyVariable |
attribute | this accesses an attribute in another object. note: this is not supported for TreeNode objects | Account:Balance |
field | this accesses a field or method in another object, or a sub-item within a field | Account.getPerson().Surname |
self method call | calling a method on the current object and using the return value | sendMessage(message) |
not | negates an expression | not Overdrawn |
and | logical and | Overdrawn and WithinRedZone |
or | logical or | DepositAccount or CurrentAccount |
equality | equality test | Name="Simon" |
inequality | inequality test | Name!="Simon" |
less than | integer less than | a lt b or a < b |
less than or equal to | integer less than or equal to | a le b or a <= b |
greater than | integer greater than | a gt b or a > b |
greater than or equal to | integer greater than or equal to | a ge b or a >= b |
subtract | integer subtract | 12 - 1 |
add | integer addition | 12 + 1 |
minus | integer inversion | - 1 |
times | integer multiplication | 12 * 1 |
divide | integer division | 12 / 1 |
modulus | integer modulus | 12 % 1 |
concatenation | adding two strings together | "First Name " # " Surname" or "First Name " & " Surname" |
subexpression | for grouping expressions and enforcing precedence | (4+1)+5 |
array index | for accessing child objects (indices start from 0) | a=f[6] |