[U2] Forcing a boolean comparison?

2006-09-20 Thread jjuser ud2

Good evening,

In UniBasic, does a statement like:

isTRUE=(TRUE<12>="Y")

force a boolean comparison instead of an assignment, such that isTRUE
is assigned a 1 or 0 as a value?
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Forcing a Boolean comparison?

2006-09-20 Thread Bob Woodward
I use this method quite frequently.  One of the things I just did was
something like that:

DL.TOP = CLINE - INT(WDEPTH/2)
DL.BOT = CLINE + INT(WDEPTH/2) + (REM(WDEPTH/2) NE 0)

The last part is going to give me either a 0 or a 1 depending on the odd
or even value of WDEPTH. I now have which lines to display above and
below my current line.  There's more to that calculation but it gives an
example of what you're wanting to do.

HTH's

BobW
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of jjuser ud2
Sent: Wednesday, September 20, 2006 3:55 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] Forcing a boolean comparison?

Good evening,

In UniBasic, does a statement like:

isTRUE=(TRUE<12>="Y")

force a boolean comparison instead of an assignment, such that isTRUE
is assigned a 1 or 0 as a value?
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Forcing a boolean comparison?

2006-09-20 Thread Kevin King
>In UniBasic, does a statement like:
>isTRUE=(TRUE<12>="Y")
>force a boolean comparison instead of an 
>assignment, such that isTRUE is assigned 
>a 1 or 0 as a value?

Yes.  Note that historically the name TRUE has been a favored equate
name, ala:

EQU TRUE TO 1

...or defined as a variable denoting truth:

TRUE = (1 EQ 1)

...therefore exercise caution with this word as a variable name when
modifying legacy code.  Also, note that I personally prefer the two
letter comparators (EQ, NE, etc.) to improve readability as it
provides some differentiation between the assignment and comparator
operators.

-Kevin
[EMAIL PROTECTED]
http://www.PrecisOnline.com
 
** Check out scheduled Connect! training courses at
http://www.PrecisOnline.com/train.html.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Forcing a boolean comparison?

2006-09-20 Thread Jeff Butera

On Wed, 20 Sep 2006, jjuser ud2 wrote:


In UniBasic, does a statement like:
isTRUE=(TRUE<12>="Y")
force a boolean comparison instead of an assignment, such that isTRUE
is assigned a 1 or 0 as a value?


Yes.  The following outputs '2 0'

X = 2
Z = (X = 3)
PRINT X:' ':Z

Jeff Butera, Ph.D.
Administrative Systems
Hampshire College
[EMAIL PROTECTED]
413-559-5556

"You're not right, Daddy"
   my 3-year old showing her wisdom
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Forcing a boolean comparison?

2006-09-20 Thread jjuser ud2

Thanks, everybody who replied!  I couldn't find the documentation
anywhere, but it looks like that's what it did :)  On the other hand,
there's just so much documentation to search through that I sometimes
have a tough time.

On 9/20/06, Jeff Butera <[EMAIL PROTECTED]> wrote:

On Wed, 20 Sep 2006, jjuser ud2 wrote:

> In UniBasic, does a statement like:
> isTRUE=(TRUE<12>="Y")
> force a boolean comparison instead of an assignment, such that isTRUE
> is assigned a 1 or 0 as a value?

Yes.  The following outputs '2 0'

X = 2
Z = (X = 3)
PRINT X:' ':Z

Jeff Butera, Ph.D.
Administrative Systems
Hampshire College
[EMAIL PROTECTED]
413-559-5556

"You're not right, Daddy"
my 3-year old showing her wisdom
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Forcing a boolean comparison?

2006-09-21 Thread Raymond DeGennaro II

At 18:14 -0600 2006/09/20, Kevin King wrote:
Also, note that I personally prefer the two letter comparators (EQ, 
NE, etc.) to improve readability as it provides some differentiation 
between the assignment and comparator operators.


Allong these lines, I try to use a technique from my C days:  Put the 
constant on the left:

"Y" = theVar
This way, if something happens and the boolean context is lost, 
you'll get a compiler error and not a hidden assignment that could be 
hard to find.  It's not as useful because mvBASIC doesn't use == for 
comparison and = for assignment, so you're less likely to have and 
accidental assigment, but it doesn't hurt, if you can develop the 
habit.


Ray
--
.=.
| =-=-=-=-=-=-= Eagle Rock Information Systems Corp =-=-=-=-=-=-= |
| -=-=-=-=-=-=- web and database business solutions -=-=-=-=-=-=- |
|      |
|Midwest Regional Office: 815-547-0662 (voice)  815-547-0353 (Fax)|
.=.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Forcing a boolean comparison? {unclassified}

2006-09-20 Thread HENDERSON MIKE, MR
Yes

Better still, 
isTRUE=TRUE<12>="Y" 
Works the same and can be tricky to find when the second "=" is a typo
for adjacent or shifted keys "-" or "+"
:-(

Which is why I much prefer to see
isTRUE = @FALSE
IF TRUE<12> EQ "Y" THEN isTRUE = @TRUE

As a convention, I always use "=" for assignment only and "EQ" for
comparison


Mike

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of jjuser ud2
> Sent: Thursday, 21 September 2006 10:55
> To: u2-users@listserver.u2ug.org
> Subject: [U2] Forcing a boolean comparison?
> 
> Good evening,
> 
> In UniBasic, does a statement like:
> 
> isTRUE=(TRUE<12>="Y")
> 
> force a boolean comparison instead of an assignment, such 
> that isTRUE is assigned a 1 or 0 as a value?
The information contained in this Internet Email message is intended
for the addressee only and may contain privileged information, but not
necessarily the official views or opinions of the New Zealand Defence Force.
If you are not the intended recipient you must not use, disclose, copy or 
distribute this message or the information in it.

If you have received this message in error, please Email or telephone
the sender immediately.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/