Siebel VB Language Reference > Methods Reference for Siebel VB > Variable Manipulation Methods >

Assign Expression to Variable Statement


The Assign Expression to Variable statement is a predefined VB statement that assigns an expression to a Visual Basic variable. It does not return a value. You can use it to assign a value or expression to a variable that is of one of the following data types:

  • Numeric
  • String
  • Variant
  • Record

If you use this statement to assign a value to a numeric variable or to a string variable, then Siebel VB applies the standard conversion rules.

You can use this statement to assign a value to a field in a record or to assign a value to an element in an array.

The Let keyword is optional. Let is different from Set because Set assigns a variable to a COM object. For example:

  • Set o1 = o2. Sets the object reference.
  • Let o1 = o2. Sets the value of the default member.
Format

[Let] variable = expression

The following table describes the arguments that you can use with this method.

Argument
Description

variable

The variable where Siebel VB assigns a value.

expression

The expression that contains the value that Siebel VB assigns.

Example

The following example uses the Assign Expression to Variable statement for the sum variable. It calculates an average of 10 golf scores:

Sub Button_Click
      Dim score As Integer
      Dim x, sum
      Dim msgtext
      Let sum = 34
      For x = 1 to 10
         score = 76
         sum = sum + score
      Next x
      msgtext = "Your average is: " & CInt(sum/(x-1))
End Sub

Related Topics

Declare Symbolic Constant Method

Siebel VB Language Reference Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Legal Notices.