Wednesday, January 26, 2011

How to set string, boolean, integer, and decimal variables

Setting a string variable.
 Dim aString As String
  
aString = "Hello World"
Setting a boolean variable
 Dim runningVB As Boolean
  
 ' Check to see if program is running on Visual Basic engine.
  
 If scriptEngine = "VB" Then
  
   runningVB = True
  
 End If
  
Setting an integer variable
 Dim k As Integer
  
 ' The following statement sets k to 6.
  
 k = 5.9
  
 ' The following statement sets k to 4
  
 k = 4.5
  
 ' The following statement sets k to 6
  
 k = 5.5
  
Setting a decimal variable
 Dim d1, d2 As Decimal
d1 = 2.3
d2 = 4.8  


1 comment:

  1. I'm finally getting around to grading. In your string and decimal examples... make sure you set it to a value.

    ReplyDelete