UDFs_01 : Defining and calling


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.



   cCurrent:= "01:43" 

   ? AmPm( cCurrent)


RETURN // Main()


FUNCTION AmPm( cTime )

   IF VAL( cTime ) < 12
      cTime += " am"
   ELSEIF VAL( cTime ) = 12
      cTime += " pm"
      cTime += STR( VAL( cTime ) - 12, 2 ) +;
               SUBSTR( cTime, 3 ) + " pm"

RETURN cTime // AmPm()


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.