Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is the purpose of LPARAMETERS
Message
From
12/06/2014 10:09:42
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01601772
Message ID:
01601777
Views:
69
Backing up a step...

In VFP, there is no difference defining a procedure or function. The following examples are identical.
PROCEDURE SomeSubRoutine
LPARAMETERS One, Two
Three = One + Two
RETURN Three
END PROC

FUNCTION SomeOtherSubRoutine
LPARAMETERS One Two
Three = One + Two
RETURN Three
END FUNC
The difference is in how you call them. This first example is calling as a procedure

a = 1
b = 2
DO SomeOtherSubRoutine WITH a, b

No value will be returned
by default, a and b will be passed by reference. To pass a by value:
DO SomeOtherSubRoutine WITH (a), b
This example is calling as a function
c = 1
d = 2
e = SomeSubRoutine(c, d)
A value will be returned
by default, c and d will be passed by value. To pass c by reference
e = SomeSubRoutine(@c, d)
>Hi,
>
>Specifically I mean, as far as the title, what is the purpose of the "L" in LPARAMETERS. I understand it means "local" but the following example shows that it is not quite local:
>
>
>LOCAL lVar1, lVar2
>
>STORE 1 TO  lVar1, lVar2
>
>=TestFunct( lVar1, @lVar2 )
>
>? lVar1, lVar2
>
>FUNCTION TestFunct
>LPARAMETERS lVar1, lVar2
>
>lVar2 = 122
>
>RETURN
>
>
>Or does it mean that the "@" overrides the L in LPARAMETERS?
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform