how do you make the variable declaration mandatory?what is the use of "option explicit"?
Answers were Sorted based on User's Feedback
Option Explicit
Dim strValue, strValue
strValue = 20
'Expected Error: Name(Variable) is redefined
Dim intA, intB
intC= intA+intB
'Expected Error: Name(Variable is undefined)
Note: If we can use Option Explicit we have To pass the all the variables And it Is indentify undefined And redefined
variables
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sonali
Option explicit will make compulsory to define each variable in the script .
if at the top of the script we have written "Option Explicit" and in Dim only two variables assigned but in script somewhere used 3rd and 4th variable also .
then it will display an error message stating that "Variable is Undefined " .
It will be very very usefull in lenghy scripts where we will use different Functions and then call functions .
| Is This Answer Correct ? | 0 Yes | 0 No |
Difference between Do while loop and while wend loop
Which operator is used for fetching the modulus of the 2 numbers in the vbscript language?
Differentiate javascript and vbscript?
Mention what are the rules to name variable in vbscript?
What is the difference between javascript and vbscript?
What is difference between Active screen and movie screen recorder in QTP 9.2?
Plz give the vb script for the following scenerio. In travel booking we have to select from delhi to mumbai from the combobox The prices will be display in another combo box .But i have to select the lowest price for it and submit it
How can you have different number of cells for each row of a table in HTML?
Why to add checkpoint in QTP What's the purpose of checkpoints & how to add it
Which object is used to work with the excel sheets in the vbscript language and what statement is used to create this object?
Explain the operator precedence in vb script?
How many types of procedures are available in the vbscript language?