FBWiki : KeyPgOpAssignment

FBWiki :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Operator = (Assign)


Assigns a value to a variable

Syntax:
declare operator Let ( byref lhs as T1, byref rhs as T2 )

Usage:
lhs = rhs

or, in the QB dialect,

[ Let ] lhs = rhs

Parameters:
lhs
The variable to assign to.
T1
Any numeric, string or pointer type.
rhs
The value to assign to lhs.
T2
Any type convertible to T2.

Description:
This operator assigns the value of its right-hand side operand (rhs) to its left-hand side operand (lhs). The right-hand side operand must be implicitly convertible to the left-hand side type (T1). For example, you cannot assign a numeric value to a string type; to do that, first convert the numeric value to a string using Str or Wstr.

Avoid confusion with Operator = (Equal), which also uses the '=' symbol.

This operator can be overloaded for user-defined types.

Examples:
Dim i As Integer
i = 420    ' <- this is the assignment operator

If  i = 69 Then   '<-this is the equivalence operator
  Print "ERROR: i should equal 420"
  End -1
End If

Print "All is good."
End 0


' compile with -lang fblite or qb

#lang "fblite"

Dim i As Integer
Let i = 300 ' <-alternate syntax
 


Dialect Differences:

Differences from QB:

See also:

Back to Assignment Operators
Back to Operators

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.0



sf.net phatcode