>= Greater than or equal

 


 >=
 Greater than or equal--binary                   (Relational)
------------------------------------------------------------------------------
 Syntax

     <exp1> >= <exp2>

 Type

     Character, date, logical, memo, numeric

 Operands

     <exp1> and <exp2> are expressions of any data type to be
     compared.

 Description

     The greater than or equal to operator (>=) is a binary operator that
     compares two values of the same data type and returns true (.T.) if
     <exp1> is greater than or equal to <exp2>.

     .  Character:  The comparison is based on the underlying ASCII
        code.  ASCII codes for alphabetic characters are ascending (e.g., the
        code for "A" is 65 and the code for "Z" is 90).

     .  Date: Dates are compared according to the underlying date
        value.

     .  Logical: True (.T.) is greater than false (.F.).

     .  Memo: Treated the same as character.

     .  Numeric: Compared based on magnitude.

 Examples

     .  These examples illustrate how the greater than or equal
        operator (>=) behaves with different data types:

        // Character
        ? "Z" >= "A"             // Result: .T.

        ? "AZ" >= "A"            // Result: .T.
        ? "A" >= "AZ"            // Result: .F.

        // Date
        ? CTOD("12/12/88") >= ;
           CTOD("12/11/88")      // Result: .T.

        // Logical
        ? .T. >= .F.             // Result: .T.

        // Numeric
        ? 2 >= 1                 // Result: .T.
        ? 1 >= 2                 // Result: .F.
        ? 2 >= 2                 // Result: .T.

See Also: $ < <= <> = (equality) == >

Advertisements

> Greater than

 


 >
 Greater than--binary                            (Relational)
------------------------------------------------------------------------------
 Syntax

     <exp1> > <exp2>

 Type

     Character, date, logical, memo, numeric

 Operands

     <exp1> and <exp2> are expressions of any type to be compared.

 Description

     The greater than (>) operator compares two values of the same data type
     and returns true (.T.) if <exp1> is greater than <exp2>.

     .  Character: The comparison is based on the underlying ASCII
        code.  ASCII codes for alphabetic characters are ascending (e.g., the
        code for "A" is 65 and the code for "Z" is 90).

     .  Date: Dates are compared according to the underlying date
        value.

     .  Logical: True (.T.) is greater than false (.F.).

     .  Memo: Treated the same as character.

     .  Numeric: Compared based on magnitude.

 Examples

     .  These examples illustrate how the greater than operator (>)
        behaves with different data types:

        // Character
        ? "Z" > "A"             // Result: .T.
        ? "AZ" > "A"            // Result: .F.
        ? "A" > "AZ"            // Result: .F.

        // Date

        ? CTOD("12/12/88") > ;
           CTOD("12/11/88")     // Result: .T.

        // Logical
        ? .T. > .F.             // Result: .T.

        // Numeric
        ? 2 > 1                 // Result: .T.
        ? 1 > 2                 // Result: .F.

See Also: $ < <= <> = (equality) == >=

 

== Exactly equal

 


 ==
 Exactly equal--binary                           (Relational)
------------------------------------------------------------------------------
 Syntax

     <exp1> == <exp2>

 Type

     All

 Operands

     <exp1> and <exp2> are expressions of the same data type to be
     compared.

 Description

     The exactly equal operator (==) is a binary operator that compares two
     values of the same data type for exact equality depending on the data
     type.  It returns true (.T.) if <exp1> is equal to <exp2> according to
     the following rules:

     .  Array:  Compares for identity.  If <exp1> and <exp2> are
        variable references to the same array, returns true (.T.); otherwise,
        returns
        false (.F.).

     .  Character:  Comparison is based on the underlying ASCII code.
        ASCII codes for alphabetic characters are ascending (e.g., the code
        for "A" is 65 and the code for "Z" is 90).  Unlike the relational
        equality operator (=) , true (.T.) is returned if <exp1> and <exp2>
        are exactly equal including trailing spaces; otherwise, the
        comparison returns false (.F.).  SET EXACT has no effect.

     .  Date:  Dates are compared according to the underlying date
        value; behaves the same as the relational equality operator (=).

     .  Logical:  True (.T.) is exactly equal to true (.T.), and false
        (.F.) is exactly equal to false (.F.).

     .  Memo:  Treated the same as character.

     .  NIL:  True (.T.) if compared to a NIL value; false (.F.) if
        compared to a value of any other data type.

     .  Numeric:  Compared based on magnitude; behaves the same as the
        relational equality operator (=).

     .  Object: Treated the same as array.

 Examples

     .  These examples illustrate how the == operator behaves with
        different data types:

        // Character
        ? "A" == "A"             // Result: .T.
        ? "Z" == "A"             // Result: .F.
        ? "A" == "A "            // Result: .F.
        ? "AA" == "A"            // Result: .F.

        // Array or object

        aOne := { 1, 2, 3 }
        aTwo := { 1, 2, 3 }
        aThree := aOne
        ? aOne == aTwo           // Result: .F.
        // values within the arrays are equal, but the arrays,
        // themselves, are separate and distinct
        ? aOne == aThree         // Result: .T.

See Also: $ < <= <> = (equality) > >=

= (equality) Equal

= (equality)
 Equal--binary                                   (Relational)
------------------------------------------------------------------------------
 Syntax

     <exp1> = <exp2>

 Type

     Character, date, logical, memo, NIL, numeric

 Operands

     <exp1> and <exp2> are expressions of the same data type to
     compare.

 Description

     The equal operator (= ) compares two values of the same data type and
     returns true (.T.) if <exp1> is equal to <exp2> according to the
     following rules:

     .  Character:  The comparison is based on the underlying ASCII
        code.  ASCII codes for alphabetic characters are ascending (e.g., the
        code for "A" is 65 and the code for "Z" is 90).

        When EXACT is OFF, two character strings are compared according to
        the following rules.  assume two character strings, cLeft and cRight,
        where the expression to test is (cLeft = cRight):

        -  If cRight is null, returns true (.T.).

        -  If LEN(cRight) is greater than LEN(cLeft), returns false
           (.F.).

        -  Compare all characters in cRight with cLeft.  If all
           characters in cRight equal cLeft, returns true (.T.); otherwise,
           returns false (.F.).

        With EXACT ON, two strings must match exactly except for trailing
        blanks.

     .  Date: Dates are compared according to the underlying date
        value.

     .  Logical: True (.T.) is equal to true (.T.) and false (.F.)
        equal to false (.F.).

     .  Memo: Treated the same as character.

     .  NIL: True (.T.) if compared to a NIL value; false (.F.) if
        compared to a value of any other data type.

     .  Numeric: Compared based on magnitude.

 Examples

     .  These examples illustrate how the equal operator (=) behaves
        with different data types:

        // Character
        SET EXACT ON
        ? "123" = "123  "        // Result: .T.
        ? " 123" = "123"         // Result: .F.
        SET EXACT OFF
        ? "123" = "12345"        // Result: .F.
        ? "12345" = "123"        // Result: .T.
        ? "123" = ""             // Result: .T.
        ? "" = "123"             // Result: .F.

        // Date
        ? CTOD("12/12/88") = ;
           CTOD("12/12/88")      // Result: .T.

        // Logical
        ? .T. = .T.              // Result: .T.
        ? .F. = .T.              // Result: .F.

        // NIL
        ? NIL = NIL              // Result: .T.
        ? NIL = 12               // Result: .F.
        ? NIL = CTOD("")         // Result: .F.

        // Numeric
        ? 2 = 1                  // Result: .F.
        ? 1 = 1                  // Result: .T.

See Also: $ < <= <> == > >=

= Compound assignment

 


 = (compound assign)
 Compound assignment--binary                     (Assignment)
------------------------------------------------------------------------------
 Syntax

     <idVar>  += <cString>         (concatenation)
     <idVar>  += <nNumber>         (addition)
     <idVar>  -= <cString>         (concatenation)
     <idVar>  -= <nNumber>         (subtraction)
     <idVar>  -= <dDate>           (subtraction)
     <idVar>  *= <nNumber>         (multiplication)
     <idVar>  /= <nNumber>         (division)
     <idVar>  %= <nNumber>         (modulus)
     <idVar>  ^= <nNumber>         (exponentiation)

 Type

     Character, date, memo, numeric

 Operands

     <idVar> is a variable identifier of any storage class, including a
     field variable.  The variable must be initialized to a value before
     performing the operation.

     If the reference to <idVar> is ambiguous (i.e., not declared at compile
     time and not explicitly qualified with an alias), <idVar> is assumed to
     be MEMVAR.  You can assign field variables by declaring the field
     variable name in a FIELD statement or referring to the field name
     prefaced by the FIELD-> alias or the name of the work area.

     <cString> is the character string used in the operation with
     <idVar>.

     <nNumber> is the numeric expression used in the operation with
     <idVar>.

     <dDate> is the date value used in the operation with <idVar>.

 Description

     In addition to the simple and inline assignment operators (= and :=),
     there are a series of compound assignment operators that perform an
     operation then assign a value.  They have the form:

     <idVar> <operator>= <exp>

     Each compound assignment expression is equivalent to the assignment
     expression:

     <idVar> := ( <idVar> <operator> <exp> )

     For each data type that supports an operator, the compound assignment
     operator performs the same operation before performing the assignment
     operation.  The  following table details all of the compound operators:

     Compound Operators
     ------------------------------------------------------------------------
     Operator     Defined as     Operations
     ------------------------------------------------------------------------
     a += b       a := (a + b)   concatenation, addition
     a -= b       a := (a - b)   concatenation, subtraction
     a *= b       a := (a * b)   multiplication
     a /= b       a := (a / b)   division
     a %= b       a := (a % b)   modulus
     a ^= b       a := (a ^ b)   exponentiation
     ------------------------------------------------------------------------

     Note:  The exponentiation operator (**) does not have a
     corresponding compound assignment operator.  The exponentiation compound
     assignment operator is ^=.

     Since the compound assignment operators are based on the inline
     assignment  operator (:=), the operation returns the result of its
     operation as the value of the expression.  This means you can use these
     operators within expressions just like the inline assignment operator
     (:=).

 Examples

     .  These examples use the compound addition and concatenation
        assignment operator:

        // Character (concatenation)
        LOCAL cString := "Hello"
        ? cString += " there"           // Result: "Hello there"

        // Date (addition)
        LOCAL dDate := CTOD("12/12/90")
        dDate += 12                     // Result: 12/24/90

        // Numeric (addition)
        LOCAL nValue := 10
        ? SQRT(nValue += 15)            // Result:  5.00
        ? nValue                        // Result: 25.00

     .  These examples use the compound subtraction and concatenation
        assignment operator:

        // Character (concatenation)
        LOCAL cString := "Hello   "
        ? cString -= "There"            // Result: HelloThere

        // Date (subtraction)
        LOCAL dDate := CTOD("12/24/90")
        dDate -= 12                     // Result: 12/12/90

        // Numeric (subtraction)
        LOCAL nValue := 10
        ? newValue := (nValue -= 5) ** 2       // Result: 25
        ? nValue                               // Result:  5

     .  This example uses the compound multiplication assignment
        operator:

        LOCAL nValue := 10
        ? newValue := (nValue *= 5) + 100      // Result: 150
        ? nValue                               // Result:  50

     .  This example uses the compound division assignment operator:

        LOCAL nValue := 10
        ? newValue := (nValue /= 5) + 100      // Result: 102.00
        ? nValue                               // Result:   2.00

     .  This example uses the compound modulus assignment operator:

     LOCAL nValue := 10
        ? newValue := (nValue %= 4) * 100      // Result: 200.00

        ? nValue                               // Result:   2.00

     .  This example uses the compound exponentiation assignment
        operator:

        LOCAL nValue := 10
        ? newValue := (nValue ^= 3) + 50       // Result: 1050.00
        ? nValue                               // Result: 1000.00

See Also: % * ** + ++ – — / :=

= Simple assign

 = (assign)
 Simple assign--binary                           (Assignment)
------------------------------------------------------------------------------
 Syntax

     <idVar> = <exp>

 Type

     All

 Operands

     <idVar> is a valid variable identifier of any storage class,
     including a field variable.  If <idVar> is not visible or does not
     exist, a private variable is created and assigned the result of <exp>.

     <exp> is the expression whose result is assigned to <idVar>.

 Description

     The simple assignment operator (=) assigns a value to a variable.  It is
     identical in operation to the STORE command that initializes a single
     variable and must be specified as a program statement.  The inline
     assignment operator (:=) is like the = operator except that you can
     specify it within expressions.  If you specify the simple assign
     operator (=) within an expression, it is interpreted as the equality (=)
     operator.

     Note:  You cannot initialize a specific variable using the simple
     assign operator (=) in a declaration statement.  Only the inline assign
     (:=) operator can be used for this purpose.

     If the reference to <idVar> is ambiguous (i.e., not declared at compile
     time and not explicitly qualified with an alias), <idVar> is always
     assumed to be MEMVAR.  At runtime, if no private or public variable
     exists with the specified name, a private variable is created.  To
     assign a field variable with the = operator, you must declare the field
     variable name in a FIELD statement or refer to the field name prefaced
     by the FIELD-> alias or the name of the work area.

 Examples

     .  These examples are valid simple assignment statements:

        nValue = 25
        nNewValue = SQRT(nValue) ** 5
        nOldValue = nValue

     .  In this example, the two lines are equivalent:

        FIELD->CustAge = 20
        REPLACE CustAge WITH 20

See Also: ++ — := = (compound) STORE*

 

!= # Not equal

 


 <> != #
 Not equal--binary                               (Relational)
------------------------------------------------------------------------------
 Syntax

     <exp1> <> <exp2>
     <exp1> != <exp2>
     <exp1> #  <exp2>

 Type

     Character, date, logical, memo, NIL, numeric

 Operands

     <exp1> and <exp2> are expressions of the same data type or NIL
     to be compared for inequality.

 Description

     The not equal ( <>) operator compares two values of the same data type
     and returns true (.T.) if <exp1> is not equal to <exp2> according to the
     following rules:

     .  Character:  The comparison is based on the underlying ASCII
        code and is the inverse of the equal operator (=).  This means that
        the comparison is sensitive to the current EXACT SETting.  See the
        examples below.

     .  Date:  Dates are compared according to the underlying date
        value.

     .  Logical:  False (.F.) is not equal to true (.T.).

     .  Memo:  Treated the same as character.

     .  NIL:  All values compared to NIL other than NIL return true
        (.T.).

     .  Numeric:  Compared based on magnitude.

 Examples

     .  These examples illustrate how the not equal operator (<>)
        behaves with different data types:

        // Character
        SET EXACT ON
        ? "123" <> "12345"         // Result: .T.
        ? "12345" <> "123"         // Result: .T.
        ? "123" <> ""              // Result: .T.
        ? "" <> "123"              // Result: .T.
        SET EXACT OFF
        ? "123" <> "12345"         // Result: .T.
        ? "12345" <> "123"         // Result: .F.
        ? "123" <> ""              // Result: .F.
        ? "" <> "123"              // Result: .T.

        // Date
        ? CTOD("12/12/88") <> ;
           CTOD("12/12/88")        // Result: .F.

        // Logical
        ? .T. <> .T.               // Result: .F.
        ? .T. <> .F.               // Result: .T.

        // NIL
        ? NIL <> NIL               // Result: .F.
        ? NIL <> 12                // Result: .T.
        ? NIL <> "hello"           // Result: .T.

        // Numeric
        ? 2 <> 1                   // Result: .T.
        ? 1 <> 1                   // Result: .F.

See Also: $ < <= = (equality) == > >=