Ralph Zbrog
New User
Joined: 21 Nov 2009 Posts: 58 Location: California
|
|
|
|
There have been no postings for a while, so here's a tidbit from my Tips'n'Techniques collection.
A LOGICAL variable can have only one of two values: False or True, represented internally as H'00' and H'01', respectively. On a typical report or form, you would expect to see a blank or 'X', and that's how Natural displays them by default.
Here is a very simple program to display Natural's default values. Note that even integers (0 in the right-most bit) are considered "false" and odd integers (1 in the right-most bit) are considered "true".
Code: |
DEFINE DATA LOCAL
1 #I (I1) 1 REDEFINE #I
2 #L (L)
END-DEFINE
FOR #I = 1 5
DISPLAY #I
#L
END-FOR
END |
And here is the output:
Code: |
#I #L
---- --
1 X
2
3 X
4
5 X |
The Xs in the #L column represent "true". Using an edit mask, it's a very simple matter to make reports more self-explanatory.
Add a simple edit mask
Code: |
DISPLAY #I
#L (EM=F/T) |
to get
Code: |
#I #L
---- --
1 T
2 F
3 T
4 F
5 T |
Get a little fancier and more legible with
Code: |
DISPLAY #I
#L (EM=/TRUE)
#I #L
---- ----
1 TRUE
2
3 TRUE
4
5 TRUE
|
Use quoted strings for mixed case:
Code: |
DISPLAY #I
#L (EM=/'True')
#I #L
---- ----
1 True
2
3 True
4
5 True |
Of course the logical need not be limited to True and False.
Code: |
DISPLAY #I
#L (EM='Even'/'Odd')
#I #L
---- ----
1 Odd
2 Even
3 Odd
4 Even
5 Odd |
|
|