Here is a simple program I wrote and ran on UV 11.1.9.  It would be interesting 
to hear if UD behaves the same way.

0001: A=''
0002: CRT 'A = ':QUOTE(A):' ':
0003: IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'
0004: A=0
0005: CRT 'A = ':QUOTE(A):' ':
0006: IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'
0007: A='HELLO'
0008: CRT 'A = ':QUOTE(A):' ':
0009: IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'
0010: A=1
0011: CRT 'A = ':QUOTE(A):' ':
0012: IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'

The results are:
     A = "" FALSE
     A = "0" FALSE
     A = "HELLO" TRUE
     A = "1" TRUE

Tom Whitmore
RATEX Business Solutions


-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jim Swain
Sent: Thursday, August 01, 2013 8:24 AM
To: U2 Users List
Subject: Re: [U2] What is true

This is not true as when A='HELLO'  IF (A) returns true.

You use the parenthesis to set a Boolean variable, i.e  BRITISH = (COUNTRY = 
'ENGLAND' OR COUNTRY = 'WALES')  etc   the var BRITISH is set to 1 when the 
conditions inside the parenthesis are met, otherwise BRITISH is set to 0




Jim Swain - Developer
Telephone: +44 (0) 1295 701 810  | Fax: +44 (0) 1295 701 819

www.zafire.com

Consider the environment.  Think before you print.

This is a commercial communication from Zafire Group.
This communication is confidential and is intended only for the person to whom 
it is addressed. If you are not that person you are not permitted to make use 
of the information and you are requested to notify us immediately that you have 
received it and then destroy the copy in your possession.  Zafire Group may 
monitor outgoing and incoming e-mails.  By replying to this e-mail you consent 
to such monitoring.  This e-mail message and any attached files have been 
scanned for the presence of computer viruses. However, you are advised that you 
open attachments at your own risk.

Zafire Limited is a limited liability company registered in England and Wales. 
Co. Reg. No. 3968255. Our registered address is Zafire House, Manor Park, 
Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 754 0161 55. Zafire Aviation 
Software Limited is a limited liability company registered in England and 
Wales. Co. Reg. No. 05577742. Our registered address is Zafire House, Manor 
Park, Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 874 5890 70

If you have any concerns regarding the content of this e-mail please contact 
postmas...@zafire.com

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tom Whitmore
Sent: 01 August 2013 13:17
To: U2 Users List
Subject: Re: [U2] What is true

Hi,
To add a little more to the discussion.  I know in UniVerse this is true and I 
suspect it is true in other flavors of Pick.

If you wrap a variable in parenthesis it will be treated as a Boolean test.  
For example:

A=''
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
A=0
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
A='HELLO'
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.
A=1
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.

I have found this useful in coding.

Tom Whitmore
RATEX Business Solutions

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Brian Leach
Sent: Thursday, August 01, 2013 4:40 AM
To: 'U2 Users List'
Subject: Re: [U2] What is true

To clarify

In multivalue, True is not False, where False is anything that is 'falsy'
i.e. zero or empty.
Obviously different than other languages, notably those where true is -1 (all 
bits set on a signed integer).

So:

A = "HELLO"
IF A THEN CRT A :" WORLD"

Gives HELLO WORLD

Regarding file variables, the best way to check for these being assigned on 
UniVerse is to use FILEINFO().

If FileInfo(SomeUnassignedVariable, 0) Then
   Crt "This is an open file variable"
End Else
   Crt "This isn't"
End

Brian


_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to