Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Differences in Functions and Procedures in Fox 2.6

Status
Not open for further replies.

seekwall

Programmer
May 14, 2001
41
GB
Can someone please tell me the difference between user defined procedures and user defined functions in FoxPro 2.6. When should I use one or the other ?

The help file uses the same example, so I can't differentiate between the two.

Paul
 
Major differences:
function return one value, assigned by RETURN.
It may be write directly in expressions.
Procedure must be called "do" and,
although as function may too alter variables,
have no value.
 
Paul,
Try this answer.
You never need to use the FUNCTION statement.
The PROCEDURE statement will do the what a FUNCTION statement does.

optional - [memvar list seperated with commas]
you do not have to pass memory variables to a FUNCTION or a PROCEDURE,

However
If in you program you define a routine as a FUNCTION,
Then you MUST call it as a FUNCTION like this:
=FUNCTION([memvar list seperated with commas])
or
memvar=FUNCTION([memvar list seperated with commas])
or
if FUNCTION() > value



If in you program you define a routine as a PRODECURE, then you can call it as a PROCEDURE or as a FUNCTION like this
do PROCEDURE [with memvar list seperated with commas]
or
=PROCEDURE([memvar list seperated with commas])
or
Memvar=PROCEDURE([memvar list seperated with commas])
or
if PROCEDURE([memvar list seperated with commas]) > value David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top