VBScript is a client-side scripting language, whose syntax
confirms with
Visual Basic (rather than Java). Runs only in Microsoft Internet Explorer (IE).
Included within
<script language = "VBScript"><!
//--></script>
Comments: (apostrophe) instead of //
Variable declaration:
Dim instead of Var Note:
use & instead of + for string concatenation
Array declaration:
Dim numbers(10) Note: use ( ) instead of [ ] for subscripts
Conditional statements:
If condition Then
statements
Else
.. statements
End If
Select Case expression
Case value_1
Case value_n
Case Else default
End Select
Can use multiple
comma-separated values per case, Is
and To keywords,
and logical operators,
And, Or, Not.
Function calculate()
... body of function ...
End Function
You can define subroutines as well (dont return
values):
Sub calculate()
... body of procedure ...
End Sub
Loops:
For loop:
For var = 1 To 10 Step 2
body of loop
Next var or just Next
While loop
Do While conditional_expr Note: exits on False
body of loop
Loop
Do
body of loop
Loop Until conditional_expr Note: exits on True
I/O functions document.write(), window.alert(), confirm(), prompt() work similarly to JavaScript. There are many functions that do not have equivalents in JavaScript.