Operators in Named Expressions
Operators operate on symbols, strings, and numbers in named expressions. These are the types of operators:
- arithmetic — ^ (exponentiation), *, /, \, Mod, +, –
Both / and \ are division operators; the former produces a result of type double, the latter type integer.
Following are examples of expressions containing arithmetic operators (" -> " is shorthand for "evaluates to").
1 + "4" -> 5 2.3 * 3 -> 6.9 12/5 -> 2.4 12\5 -> 2
- comparison — <, <=, >, >=, =, <>, and, and or.
Following are examples of expressions containing comparison operators:
20 < 10 -> False 7 >= 7 -> True
- conditional — IIf(conditional,true-result,false-result)
Following are examples of expressions containing IIf:
IIf (500>200, "math OK";, "math wrong") -> "math OK" IIf (500<200, "math OK", "math wrong") -> "math wrong"
- string concatenation — &
Following are examples of expressions containing &:
1 & "4" -> "14" "Dog" & " and " & "Cat" -> "Dog and Cat"
Combined Symbols
You can build more complex expressions by combining symbols into longer ones. For example:
System.Math.Cos(System.Math.PI*45.0/180.0) -> 0.707 System.String.Length("Dog" & " and " & "Cat") -> 11
The first symbol evaluates to the cosine of a 45 degree angle. The second symbol evaluates to the character length of three concatenated strings.