ABL supports a lengthy list of built-in functions which provide the ABL developer with easy access to a specific set of capabilities. Each function accepts a well-defined list of parameters and optionally returns a value. There are many functions available for working with strings, numbers, dates and times, and other data. The ABL Syntax Reference contains reference entries for each of these functions.

The following example demonstrates calling a function called SUBSTRING to extract a portion of a string.

/* Display the first three characters of the customer's name */

FOR EACH Customer:
  DISPLAY SUBSTRING(Customer.Name, 1, 3).
END.

Another useful function is the IF...THEN...ELSE function, not to be confused with the IF...THEN...ELSE statement. This function does not look like a typical function but can be very useful in the right situation. The function evaluates and returns one of two expressions, depending on the value of a specified condition. The following example demonstrates the IF...THEN...ELSE function.

VAR INT i.

i = 2.

MESSAGE IF i EQ 1 THEN "low" ELSE "high" VIEW-AS ALERT-BOX.
Running the code produces the following output:
high

For more information, see Use built-In ABL functions in Develop ABL Applications.