<= Less than or equal

 <=
 Less than or equal--binary                      (Relational)
------------------------------------------------------------------------------
 Syntax

     <exp1> <= <exp2>

 Type

     Character, date, logical, memo, numeric

 Operands

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

 Description

     The less than or equal (<= ) operator compares two values of the same
     data type and returns true (.T.) if <exp1> is less 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: False (.F.) is less than true (.T.).

     .  Memo:  Treated the same as character.

     .  Numeric:  Compared based on magnitude.

 Examples

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

        // Character
        ? "Z" <= "A"               // Result: .F.
        ? "ZA" <= "A"              // Result: .F.
        ? "A" <= "AZ"              // Result: .T.

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

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

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

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

 

< Less than

 


 <
 Less than--binary                               (Relational)
------------------------------------------------------------------------------
 Syntax

     <exp1> < <exp2>

 Type

     Character, date, logical, memo, numeric

 Operands

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

 Description

     The less than (<) operator is a binary operator that compares two values
     of the same data type and returns true (.T.) if <exp1> is less 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: False (.F.) is less than true (.T.).

     .  Memo: Treated the same as character.

     .  Numeric: Compared based on magnitude.

 Examples

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

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

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

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

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

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

:= Inline assign

:=
 Inline 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 inline assignment operator (:=) assigns values of any data type to
     variables of any storage class.  The operator evaluates <exp>, assigns
     the resulting value to <idVar>, and returns the resulting value as the
     return value of the operation.  This latter behavior permits multiple
     assignments such as idVar1 := idVar2 := value.  Unlike the simple assign
     operator (=), the inline assignment operator (:=) can be used anywhere
     an expression or constant is allowed, including variable declaration
     statements.  With a variable declaration statement, assignment
     initializes a variable.  Note, however, you cannot declare an array and
     initialize elements within the same program statement.

     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.  You can
     assign field variables with the := operator 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.

 Examples

     .  Several examples of inline assignment follow:

        LOCAL nValue := 10
        //
        IF (dDate := (DATE() - 1000)) = CTOD("12/20/79")
        //
        ? SQRT(nValue := (nValue ** 2))
        //
        cTransNo := cSortNo := (CustId + DTOC(DATE()))

     .  This last example performs multiple assignments using the
        inline assignment operator as you would with the STORE command.  When
        := is used in this way, the assignments are executed from right to
        left.  This feature is particularly useful when you need to store the
        same value to many different fields, possibly in different database
        files.

        CustFile->CustId := TransFile-> ;
           TransNo := (CustId + DTOC(DATE())

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

 

: Send

 


 :
 Send--binary                                    (Object)
------------------------------------------------------------------------------
 Syntax

     <object>:<message>[(<argument list>)]

 Type

     Object

 Operands

     <object> is the name of the object that is to receive the message.

     <message> is the name of a method or instance variable.

     <argument list> is a list of parameters that are passed to the
     specified message.  The parentheses surrounding the argument list are
     optional if no parameters are supplied in the message send.  By
     convention, however, parentheses distinguish a message send with no
     parameters from an access to an exported instance variable.

 Description

     Each class defines a set of operations that can be performed on objects
     of that class.  Perform these operations by sending a message to the
     object using the send operator (:).

     When a message is sent to an object, the system examines the message.
     If the object is of a class that defines an operation for that message,
     the system automatically invokes a method to perform the operation on
     the specified object.  If the class does not define a method for the
     specified message, a runtime error occurs.

     Executing a message send produces a return value, much like a function
     call.  The return value varies depending on the operation performed.

 Examples

     .  In this example, myBrowse is the name of a variable that
        contains a TBrowse object reference.  pageUp() is a method that
        specifies the operation to be performed.  The available operations
        and corresponding methods vary depending on the class of the object.
        The Error, Get, TBColumn, and TBrowse classes are documented in this
        chapter.

        myBrowse:pageUp()

     .  This example forces the checkbox state to true (.T.):

        myCheck : Select (.T.)

/ Division–binary

/
 Division--binary                                (Mathematical)
------------------------------------------------------------------------------
 Syntax

     <nNumber1> / <nNumber2>

 Type

     Numeric

 Operands

     <nNumber1> is the dividend of the division operation.

     <nNumber2> is the divisor of the division operation.

 Description

     The division operator (/) returns a numeric value from the division of
     <nNumber1> by <nNumber2>.

     Note:  Dividing <nNumber1> with zero value for <nNumber2> results in
     a runtime error.

 Examples

     .  This example shows division results to 16 decimal places,
        using different operands:

        SET DECIMALS TO 16
        ?  3 /  0            // Result: Runtime error
        ?  3 / -2            // Result: -1.500000000
        ? -3 /  2            // Result: -1.500000000
        ? -3 /  0            // Result: Runtime error
        ? -1 / -3            // Result: +0.333333333
        ? -2 /  3            // Result: -0.666666667
        ?  2 / -3            // Result: -0.666666667
        ?  1 / -3            // Result: -0.333333333

See Also: % * ** + – = (compound) SET DECIMALS SET FIXED

.OR. Logical OR

.OR.
 Logical OR--binary                              (Logical)
------------------------------------------------------------------------------
 Syntax

     <lCondition1> .OR. <lCondition2>

 Type

     Logical

 Operands

     <lCondition1> and <lCondition2> are logical expressions.

 Description

     The .OR. operator is a binary logical operator that executes a logical
     OR operation using the following modified Boolean rules:

     .  Returns true (.T.) if either <lCondition1> or <lCondition2>
        evaluates to true (.T.)

     .  Returns false (.F.) if both <lCondition1> and <lCondition2>
        evaluates to false (.F.)

     Warning!  In a departure from the Summer '87 and other dialect
     behavior, Clipper shortcuts the evaluation of .OR. operands.  This
     means that <lCondition1> and <lCondition2> are both evaluated only when
     <lCondition1> evaluates to false (.F.).  If <lCondition1> evaluates to
     true (.T.), the .OR. operation is true (.T.) and <lCondition2> is,
     therefore, not evaluated.  For backward compatibility, shortcutting can
     be suppressed by compiling with the /Z option.

 Examples

     .  This example shows .OR. results using different operands:

        ? .T. .OR. .T.            // Result: .T.   (shortcut)
        ? .T. .OR. .F.            // Result: .T.   (shortcut)
        ? .F. .OR. .T.            // Result: .T.
        ? .F. .OR. .F.            // Result: .F.

See Also: .AND. .NOT.

 

.NOT. Logical NOT

.NOT.
 Logical NOT--unary                              (Logical)

 Syntax

     ! <lCondition>
     .NOT. <lCondition>

 Type

     Logical

 Operands

     <lCondition> is a logical expression to not.

 Description

     The not (!) operator is a unary logical operator that returns the
     logical inverse of <lCondition>.

 Examples

     .  This example shows .NOT. results using different operands:

        ? ! (.T.)               // Result: .F.
        ? ! 1 > 2               // Result: .T.
        ? .NOT. 1 > 2           // Result: .T.

See Also: .AND. .OR.

 

.AND. Logical AND

.AND.
 Logical AND--binary                             (Logical)
------------------------------------------------------------------------------
 Syntax

     <lCondition1> .AND. <lCondition2>

 Type

     Logical

 Operands

     <lCondition1> and <lCondition2> are logical expressions to AND.

 Description

     The .AND. operator is a binary logical operator that executes a logical
     AND operation using the following modified Boolean rules:

     .  Returns true (.T.) if both <lCondition1> and <lCondition2>
        evaluate to true (.T.)

     .  Returns false (.F.) if either <lCondition1> and <lCondition2>
        evaluate to false (.F.)

     Warning!  In a departure from Summer '87 and other dialect behavior,
     Clipper shortcuts the evaluation of .AND. operands.  This means that
     <lCondition1> and <lCondition2> are both evaluated only when
     <lCondition1> evaluates to TRUE (.T.).  If <lCondition1> evaluates to
     FALSE (.F.), the .AND. operation is FALSE (.F.) and <lCondition2> is
     therefore not evaluated.

     For backward compatibility, shortcutting can be suppressed by compiling
     with the /Z option.

 Examples

     .  This example shows .AND. results using different operands:

        ? .T. .AND. .T.            // Result: .T.
        ? .T. .AND. .F.            // Result: .F.
        ? .F. .AND. .T.            // Result: .F.   (shortcut)
        ? .F. .AND. .F.            // Result: .F.   (shortcut)


See Also: .NOT. .OR.

 

-> Alias assignment

->
 Alias assignment--binary                        (Special)
------------------------------------------------------------------------------
 Syntax

     <idAlias>-><idField>
     <idAlias>->(<exp>)
     (<nWorkArea>)-><idField>
     (<nWorkArea>)->(<exp>)
     FIELD-><idVar>
     MEMVAR-><idVar>

 Operands

     <idAlias> is the name of the unselected work area to access and must
     refer to a work area with a database file in USE.

     <nWorkArea> is the number of the unselected work area to access.

     <idField> is the name of a field in the specified work area.

     <exp> is an expression of any data type to be executed in the
     specified work area.  If an expression more complicated than a single
     field reference is used as the second operand, the expression must be
     enclosed in parentheses ( ).

     <idVar> is any valid CA-Clipper identifier.  Depending on whether
     you specify FIELD or MEMVAR, the identifier will be forced to a database
     field or memory variable (public or private) reference.

 Description

 When used with an <idAlias> as the first operand, the alias operator

     (->) accesses field information or evaluates an expression in the
     indicated work area.  The alias operator implicitly SELECTs the
     <idAlias> before evaluating the <idField> or <exp> operand.  When the
     evaluation is complete, the original work area is SELECTed again.  An
     alias reference can be in an expression or on a line by itself:

     ? Customer->Name
     Customer->(UpdateTransaction())

     Using the alias operator lets you:

     .  Access information from unselected work areas within
        expressions

     .  Access environmental information from unselected work areas

     .  Access information from unselected work areas in modes such as
        REPORT and LABEL FORMs

     .  Write more compact code

     In addition to allowing expression and field evaluation in unselected
     work areas, the alias operator makes an explicit reference to a field or
     variable using either the FIELD or the MEMVAR keyword aliases.  MEMVAR
     forces <idVar> to refer to a memory variable name, and FIELD forces it
     to reference a database field.  These special alias identifiers allow
     you to avoid ambiguity when there are conflicts between field and memory
     variable names.  Remember that a reference to a variable identifier not
     prefaced with an alias defaults to a field if there are both field and
     memory variables with the same name.  To override this, use the (/V)
     option when compiling.

     In addition to specifying the alias as an identifier, you can access the
     target work area using an expression that returns the work area number
     if the expression is enclosed by parentheses.  This lets you use work
     area numbers as handles, which is useful for passing references to work
     areas without using macros, aliases, names, etc.

 Examples

     .  This example accesses database and work area information in an
        unselected work area:

        USE Customer NEW
        USE Invoices NEW
        ? Customer->CustName                  // Result: Bill Smith
        ? Customer->(RECNO())                 // Result: 1
        ? Customer->(FOUND())                 // Result: .F.
        ? Customer->(City + ", " + State + ;
           "  " + Zip)                        // Result: ShadowVille,
                                              //         CA  90415

     .  This example uses a user-defined function (MySeek()) as an
        operand of the alias operator for a common operation that normally
        requires many more statements:

        IF Invoices->(MySeek(CustNum))
           <process customer>...
        ELSE
           <process no find>...
        ENDIF
        RETURN

        FUNCTION MySeek( cSearch )
           SEEK cSearch
        RETURN (FOUND())

        Note:  This example is just an illustration of the alias operator
        with a user-defined function.  CA-Clipper's DBSEEK() could be used
        instead of MySeek().

     .  This example explicitly references field and memory variables
        with the same name:

        USE Customer NEW
        MEMVAR->CustName = "Bill Smith"      // Create a memvar
                                             // CustName
        LOCATE FOR MEMVAR->CustName = FIELD->CustName

     .  This example uses an expression as a work area handle to
        create a work area-independent database operation:

        cTable1 := "C:Myfile.dbf"
        cTable2 := "D:Myfile.dbf"
        USE (cTable1) NEW
        hArea1 = SELECT()
        USE (cTable2) NEW
        hArea2 = SELECT()
        DoStuff( hArea1, hArea2 )

        FUNCTION DoStuff( hArea1, hArea2 )
           LOCAL nCount, nSave
           nSave := SELECT()
           SELECT (hArea1)
           FOR nCount := 1 TO FCOUNT()
              FIELDPUT( nCount, ( hArea2 )-> ;
                 ( FIELDGET( nCount )))
           NEXT
           SELECT (nSave)
           RETURN NIL

See Also: FIELD FIELDNAME() FIELDPOS() FIELDGET() SELECT

— Decrement

--
 Decrement--unary                                (Mathematical)
------------------------------------------------------------------------------
 Syntax

     --<idVar>       (prefix decrement)
     <idVar>--       (postfix decrement)

 Type

     Date, numeric

 Operands

     <idVar> is any valid CA-Clipper identifier, including a field
     variable.  If <idVar> is a field, you must reference it prefaced with an
     alias or declare it with the FIELD statement.

     In addition, you must initialize <idVar> to a value before performing
     the decrement operation, and it must be either numeric or date data
     type.

 Description

     The decrement operator (--) decreases the value of its operand by one.
     This operator subtracts one from the value of <idVar> and assigns the
     new value to <idVar>.

     The -- operator can appear before or after <idVar>.  Specifying the
     operator before <idVar> decrements and assigns the value before the
     value is used.  This is called prefix notation, and it is the most
     common usage.  Specifying the operator after <idVar> decrements and
     assigns the value after it is used.  This is postfix notation.  Stated
     differently, postfix notation delays the assignment portion of the
     operation until the rest of the expression is evaluated, and prefix
     notation gives the assignment precedence over all other operations in
     the expression.

     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.  You can assign field variables by declaring the
     field variable name in a FIELD statement or by referring to the field
     name prefaced by the FIELD-> alias or by the name of the work area.

 Examples

     .  In this example of the postfix decrement operator the
        assignment takes place before the original variable is decremented,
        thus the two values are not the same when queried:

        nValue := 1
        nNewValue := nValue--
        ? nNewValue                  // Result:   1
        ? nValue                     // Result:   0

     .  In this example, the prefix decrement operator decreases the
        first operand of the multiplication by one, making its value 9.
        Then, the assignment of this new value to the nValue variable takes
        place before the rest of the expression is evaluated.  Thus, the new
        value is used to perform the multiplication operation, and the result
        of 9 * 9 is 81.

        nValue := 10
        ? --nValue * nValue          // Result:  81
        ? nValue                     // Result:   9

See Also: ++ – := = (compound)