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 |
What are the rules to name variable in vbscript?
How strcomp function works?
a;;b;c;;;d in this string output is abcd will come how can we do that in vbscript in QTP testing?
What are the 2 ways in which a variable can be declared in the vbscript language?
Explain about operator precedence in vb script?
How to delete a cookie using vbscript?
Which object is used to work with the database in the vbscript language and what statement is used to create this object?
what is extension of the file if its saved from recovery manger to some drive
Explain about the support of asp for vb script functionality?
How can you fetch the value of a cookie?
Explain about tristate constants?
how to write a vb script in QTP for yahoo registration form, i want to check the performance also like performance test, stress, load test like that.