Difference between revisions of "Constants and Expressions"
From Recital Documentation Wiki
		
		
		
Yvonnemilne  (Talk | contribs)  | 
				Yvonnemilne  (Talk | contribs)   | 
				||
| Line 32: | Line 32: | ||
</code>  | </code>  | ||
| − | The TRANSFORM() function can be used to return a numeric as a hexadecimal.    | + | The [[TRANSFORM()]] function can be used to return a numeric as a hexadecimal.    | 
<code lang="recital">  | <code lang="recital">  | ||
| Line 42: | Line 42: | ||
==Expressions==  | ==Expressions==  | ||
| − | The TYPE() function can be used to determine the data type of any expression.  | + | The [[TYPE()]] function can be used to determine the data type of any expression.  | 
Revision as of 13:13, 24 March 2009
Constants
The Recital/4GL supports the following constants:
| Datatype | Description | 
|---|---|
| Character | A string of ASCII characters up to 8191 characters in length.
 Delimited by double quotes "", single quotes ’’ or square brackets []  | 
| Numeric | An integer number of up to 16 digits (0-9) or a floating point number of up to 25 digits (9 are reserved for decimal places) and one decimal point. | 
| Date | A combination of digits and separators delimited by curly braces {}. The format is determined by the SET DATE and SET CENTURY commands. | 
| Logical | A choice of two values, .T. for true, .F. for false | 
Hexadecimal numbers
Hexadecimal numbers, prefixed by 0x, can be used in place of decimal numbers except in the data entry/modification of numerics. (Linux platforms only).
? BITAND(0x67452301,0xFFFFFFFF)
Results of expressions will still be returned as decimal numbers.
? 0x1a * 2 52
The TRANSFORM() function can be used to return a numeric as a hexadecimal.
? transform((0x1a * 2),"@0") 0x00000034
Expressions
The TYPE() function can be used to determine the data type of any expression.
| uMemvar | TYPE("uMemvar") | Type | 
|---|---|---|
| [hello] | ’C’ | Character | 
| ’goodbye’ | ’C’ | Character | 
| "RECITAL" | ’C’ | Character | 
| 1234 | ’N’ | Numeric | 
| 1234.56 | ’N’ | Numeric | 
| "1234.56" | ’C’ | Character | 
| 0x2b | ’N’ | Numeric | 
| {01/01/96} | ’D’ | Date | 
| {01/01/1996} | ’D’ | Date | 
| "01/01/96" | ’C’ | Character | 
| .T. | ’L’ | Logical | 
| .F. | ’L’ | Logical | 
| opentags | ’P’ | Procedure | 
| OMyObj | ’O’ | Object | 
| Undetermined Type | ’U’ | Undefined |