< Application Development with Harbour 
      A harbour function looks like this.
FUNCTION calculateSum(a,b)
LOCAL sum := a + b 
RETURN sum
If you want to use above function calculateSum() you can simply do for example:
sumTwoNumbers := calculateSum(2,4) //The value 6 is saved in sumTwoNumbers 
? sumTwoNumbers //prints the value of sumTwoNumbers 
Step by step instructions to produce above result:
-Create a file called SumTwoNumbers.prg in directory C:\hb30\tests and open this file.
-Put the following code in this file:
- SumTwoNumbers.prg
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
PROCEDURE Main()
Local sumTwoNumbers := calculateSum(2,4)
? sumTwoNumbers
RETURN
FUNCTION calculateSum(a,b)
LOCAL sum := a + b
RETURN sum
-C:\hb30\bin\hbmk2.exe SumTwoNumbers.prg
-SumTwoNumbers.exe //if right you see number "6"
    This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.