/*
UDFs_01 : Defining and calling
Functions and Procedures ( sometimes referred as User Defined Function : UDF )
are basic building block of Harbour programs.
Functions and Procedures are similar, only diffrence is requirments of return value;
by definition, procedures return NIL and functions have a return value.
Practically no difference between two; functions and procedures both may or may not
return value and undefined return value is NIL.
This is a typical example of a user-defined function definition and calling it.
For more information refer here.
*/
PROCEDURE Main() cCurrent:= "01:43" ? AmPm( cCurrent) WAIT RETURN // Main() *-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._. FUNCTION AmPm( cTime ) IF VAL( cTime ) < 12 cTime += " am" ELSEIF VAL( cTime ) = 12 cTime += " pm" ELSE cTime += STR( VAL( cTime ) - 12, 2 ) +; SUBSTR( cTime, 3 ) + " pm" ENDIF RETURN cTime // AmPm()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.