Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - := assignment operator (binary) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 :=                  Assignment operator (binary)
------------------------------------------------------------------------------
 Syntax
   xVar|field := <expr>

 Arguments
   xVar is a variable identifier of any storage class.

   field is a database field name.

   <expr> is an expression whose result is assigned to xVar. The type of
   the expression must match the data type of the variable.

 Description
   The := operator moves the value of an expression into a variable.
   The operator evaluates <expr> and assigns the result to xVar.

   The := operator may also be used to assign values to database fields, as
   a replacement for the replace field with <expr> command, i. e.
   field := <expr> is an equivalent for that command.

   As Force is a strongly typed language, you may only assign expressions
   that evaluate to the data type of the variable. That is, numeric
   expressions can be assigned to numeric variables, and character
   expressions to character variables, but it is not possible to directly
   assign numeric expressions to character variables. The Force library
   provides functions for such data type conversions.

   Unlike C, Force does not allow assignments within expressions.

 Example
   #define EXAMPLE_OPERATOR
   #include example.hdr

   proc Test_928
   vardef
      char        cStr
      ptr( byte ) pChar
   enddef
   cStr := "hello"             // assign a value to a char variable
   ? cStr
   pChar := &cStr              // assign address of char to ptr( byte )
   cStr := ""                  // usual way of resetting a string
   ? cStr
   cStr := "there"
   ? cStr
   *pChar := 0                 // reset the string it via its pointer
   ? cStr
   endproc

   proc main
   Test_928()
   endproc

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson