Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Short-Circuiting with Logical Operators
Message
From
28/10/2014 03:28:35
 
 
To
28/10/2014 03:08:47
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01609995
Message ID:
01609997
Views:
68
Reminds me of message#1522465

>In one of my apps I just found and fixed a subtle edge-case bug caused by short-circuiting of logical operators. With my coding style I'm not usually vulnerable to it so it was interesting to be reminded of this feature of VFP.
>
>LOCAL ;
>	llFlag
>
>llFlag = .F.
>
>CLEAR
>
>IF MyUDF( "First Argument" ) AND llFlag
>
>ENDIF
>
>IF llFlag AND MyUDF( "Second Argument" )
>
>ENDIF
>
>RETURN
>
>FUNCTION MyUDF ( tcArgumentPosition AS String )
>
>?"MyUDF( ) called when it is " + tcArgumentPosition
>
>ENDFUNC
>
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform