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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

evaluating .t.

Status
Not open for further replies.

spuppett

Programmer
Jan 25, 2003
48
US
A quick question:

does .t. evaluate to and integer? (non-zero) I don't really know how to test it in VFP. I tried 'say .t. <> 0', but got a type mis-match.

Thanks
 
No. In VFP, .T. and .F. are logical values. To test them, you just need to use them:

Code:
IF .T.
  * do something
ENDIF

Similarly, if you have a logical variable or field, you don't have to compare it to .T. or .F. explicitly:

Code:
IF lCondition
  * do something
ENDIF

IF NOT lCondition
  * do something
ENDIF

Tamar
 
.T. is data type Logical and doesn't evaluate to any numeric data type. It can be compared only to another Logical field/expression.

Jim
 
Not completely on topic, but close. In VFP9 you can use the cast function with logical values to receive 1 or 0...

?CAST(.T. as Integer)
?CAST(.F. as Integer)


boyd.gif

 
Another point, also nearly on topic - EMPTY(.F.) returns TRUE and empty(.T.) returns FALSE.

This is handy when you want to check the value of a checkbox as you don't need to check the data type first.

Hope that helps,

Stewart
PS If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top