Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel VB Language Reference > Siebel VB Language Reference >
Let (Assignment Statement)
The Let statement is a standard VB statement that assigns an expression to a Basic variable.
Syntax
[Let] variable = expression
Placeholder Description variable The variable to which a value is to be assigned expression The expression containing the value to be assigned to variable
Returns
Not applicable
Usage
The keyword Let is optional.
The Let statement can be used to assign a value or expression to a variable with a data type of numeric, string, variant, or record variable. You can also use the Let statement to assign to a record field or to an element of an array.
When assigning a value to a numeric or string variable, standard conversion rules apply.
Let differs from Set in that 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.Example
This example uses the Let statement for the variable sum. The subroutine finds 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 SubSee Also
Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel VB Language Reference Published: 18 June 2003 |