Language Elements and Reference:xpplrm

Functions Foundation

A function is a section of program code accessed using an identifier. The program code within a function is executed when the corresponding identifier appears in the program code. Functions have a return value which is passed back to the calling program after the program code in the function is processed. This value can be stored in a variable.

Xbase++ provides app. 340 functions in its runtime library that can be used to manipulate variables, data and files.

Values can be passed to a function and are used in the program code of the function. Examples of calls to Xbase++ functions are found in the following program code:

? Chr(65)      // result: A  (converts ASCII code to characters) 
? Asc("A")     // result: 65 (converts characters to ASCII code) 

Like variables, functions are accessed using an identifier. A variable identifier represents a value. On the other hand, function identifiers identify executable program code. Function identifiers follow the same rules as variable identifiers, including that the first 255 characters of the identifier are significant. Xbase++ includes reserved identifiers for functions that cannot be used for identifiers. To retain compatibility with dBase conventions, some of the reserved function name identifiers can be abbreviated using the first four or more letters. These identifiers are listed in the following table. Generally, reserved function names should not be abbreviated to minimize possible error sources within the program code.

Reserved function names in Xbase++
ABS DELETED *) LEN REPLICATE *) TRANSFORM *)
ASC DEVPOS *) LOG ROUND *) TRIM
AT DOW LOWER *) RTRIM *) TYPE
BREAK *) DTOC LTRIM SECONDS *) UPPER *)
CDOW DTOS MAX SELECT *) VAL
CHR EMPTY *) MIN SETPOS *) VALTYPE *)
CMONTH *) FILE PCOL SPACE *) YEAR
COL IF PCOUNT *) SQRT
DATE IIF PROW STR All class
DAY INKEY *) PVALUE SUBSTR *) functions
  1. These function names can be abbreviated to the first four characters.

To execute the program code of a function, the identifier for the function must be followed by parentheses.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.