Difference between revisions of "Recital Operators"
From Recital Documentation Wiki
		
		
		
| Barrymavin  (Talk | contribs) | Yvonnemilne  (Talk | contribs)  | ||
| Line 2: | Line 2: | ||
| ===Assignment Operators=== | ===Assignment Operators=== | ||
| ===Arithmetic Operators=== | ===Arithmetic Operators=== | ||
| + | The Recital/4GL supports the use of the following Arithmetic Operators: | ||
| + | |||
| + | |||
| + | {| class="wikitable" | ||
| + | !Operator||Operation||Precedence | ||
| + | |- | ||
| + | |()||Parentheses||1 | ||
| + | |- | ||
| + | |**||Exponentiation||2 | ||
| + | |- | ||
| + | |*||Multiplication||3 | ||
| + | |- | ||
| + | |/||Division||3 | ||
| + | |- | ||
| + | |%||Modulus/Remainder||3 | ||
| + | |- | ||
| + | |+||Addition||4 | ||
| + | |- | ||
| + | |-||Subtraction||4 | ||
| + | |- | ||
| + | |} | ||
| + | |||
| + | When dealing with Date data types, the operators have the following definitions:  | ||
| + | |||
| + | |||
| + | {| class="wikitable" | ||
| + | !Operator||Operation | ||
| + | |- | ||
| + | |+||<expD> + <expN> returns a date plus the number of days specified in <expN>. | ||
| + | |- | ||
| + | |-||Returns the interval between the two dates as a number of days. | ||
| + | |- | ||
| + | |} | ||
| + | |||
| + | |||
| + | ==Example== | ||
| + | <code lang="recital"> | ||
| + | ? 2*3^2 | ||
| + |         18 | ||
| + | ? 2*25%7 | ||
| + |       1.00 | ||
| + | ? date() + 30 - date() | ||
| + |         30 | ||
| + | </code> | ||
| + | |||
| + | |||
| ===Comparison Operators=== | ===Comparison Operators=== | ||
| ===Increment and Decrement Operators=== | ===Increment and Decrement Operators=== | ||
| ===String Concatenation Operator=== | ===String Concatenation Operator=== | ||
| + | When dealing with string data types, the + and - operators perform the following concatenation operations:  | ||
| + | |||
| + | {| class="wikitable" | ||
| + | !Operator||Operation | ||
| + | |- | ||
| + | |+||Concatenate the right hand string to the end of the left hand string. | ||
| + | |- | ||
| + | |-||Concatenate the right hand string to the end of the left hand string after trimming the left hand string of trailing spaces. | ||
| + | |- | ||
| + | |} | ||
| + | |||
| + | '''Example''' | ||
| + | <code lang="recital"> | ||
| + | ? [Hello] + [ ] + [ World] | ||
| + | Hello World | ||
| + | ? [Hello     ] - [ World] | ||
| + | Hello World | ||
| + | </code> | ||
| + | |||
| ===String Search Operator=== | ===String Search Operator=== | ||
| ===String Substitution Operator=== | ===String Substitution Operator=== | ||
Revision as of 13:13, 6 November 2009
Contents
Recital Operators
Assignment Operators
Arithmetic Operators
The Recital/4GL supports the use of the following Arithmetic Operators:
| Operator | Operation | Precedence | 
|---|---|---|
| () | Parentheses | 1 | 
| ** | Exponentiation | 2 | 
| * | Multiplication | 3 | 
| / | Division | 3 | 
| % | Modulus/Remainder | 3 | 
| + | Addition | 4 | 
| - | Subtraction | 4 | 
When dealing with Date data types, the operators have the following definitions:
| Operator | Operation | 
|---|---|
| + | <expD> + <expN> returns a date plus the number of days specified in <expN>. | 
| - | Returns the interval between the two dates as a number of days. | 
Example
? 2*3^2 18 ? 2*25%7 1.00 ? date() + 30 - date() 30
Comparison Operators
Increment and Decrement Operators
String Concatenation Operator
When dealing with string data types, the + and - operators perform the following concatenation operations:
| Operator | Operation | 
|---|---|
| + | Concatenate the right hand string to the end of the left hand string. | 
| - | Concatenate the right hand string to the end of the left hand string after trimming the left hand string of trailing spaces. | 
Example
? [Hello] + [ ] + [ World] Hello World ? [Hello ] - [ World] Hello World
