Exercises: VBScript
EXERCISES
=========
1. Write the item below as a comment using the 2 forms of comments that are available in VBScript
This is a comment
2. Fix the following line of code of code using any of the 2 comment keywords. When you are done, the code should run properly and print 'Hello World' 2 time
Declaring variables
Dim strMessage
Dim numLoop
strMessage = "Hello World" Assigning a value to my variable
For numLoop = 0 To 1 Step 1
Printing a message
Msgbox strMessage This will display the message
Next
The end of the code
3. We used the InputBox function to ask the user for input. Complete the following script so that when I run it, it will ask me for a number and then it will double the number and display it to me.
Option Explicit
Dim numValue
numValue = InputBox("Please enter a number")
4. Create a script that accepts any numerical input and then displays a message if the number is a prime number or not.
[Note: A prime number is a number that is a non-negative and that is only divisible by one and itself]
<< Home