Logical operator isn't operating!

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
Mistfall
Posts: 23
Joined: Tue Dec 30, 2008 1:26 pm
Contact:

Logical operator isn't operating!

Post by Mistfall » Sun Jan 18, 2009 5:02 am

Hello kind and helpful Rev users,

I'm trying to use the operator "greater than or equal to" in a script as follows:

put the first character of line x of field "theField" into whichChar
put charToNum(whichChar) into whatCase
if whatCase is >= 65 then
put whatCase into message

I get a compilation error at line (if whatCase...then) (Expression: double binary operator) near ">=", near character (the space before the 65).

What does "double binary operator" mean? (I tried compiling with only a ">" and still got the same error.) Where did I go wrong?

Thank you for any help!

Obleo
Posts: 174
Joined: Mon Apr 10, 2006 10:35 pm
Location: Chicago
Contact:

Post by Obleo » Sun Jan 18, 2009 7:30 am

I had a similar issue with this once, and from my notes I fixed it by putting the value between double quotes.

like this; if whatCase is >= "65" then put whatCase into message

I did not try your script but you may want to try this and see if that fixes it.

good luck

Obleo
Posts: 174
Joined: Mon Apr 10, 2006 10:35 pm
Location: Chicago
Contact:

Post by Obleo » Sun Jan 18, 2009 7:39 am

Actually I did just try your script . Remove the term "is" in front of the operator ">="

so that line would read this :

if whatCase >= 65 then put whatCase into message.

It work with and without the double qoutes by just remove the term "is"

hope that helps.

Mistfall
Posts: 23
Joined: Tue Dec 30, 2008 1:26 pm
Contact:

Aha!

Post by Mistfall » Sun Jan 18, 2009 3:22 pm

Thank you, Obleo!

I appreciate that!

Lynn P.
Posts: 79
Joined: Sun Apr 09, 2006 1:09 pm

Post by Lynn P. » Sun Jan 18, 2009 3:57 pm

Mistfall wrote: What does "double binary operator" mean?
The word "is" in Rev is a synonym for "=" allowing you to use English in an expression such as:
if x is 34 then
or
if x = 34 then
so you got a "double binary operator" error from Rev because you're expression:
if whatCase is >= 65 then put whatCase into message...
had essentially both "=" and ">=" (two binary operators)
Rev saw it as:
if whatCase = >= 65 then put whatCase into message...
When reading >=, the word "is" in implied but not included in the code, as it is in most other programming languages.
In Rev, you can use "=" or in your case ">=" OR "is" but not both.

:)

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”