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 |
How to check the particular window is exist or not with out using check points
In qtp, how to use XML files for framework. if the XML files are more Efficient than Excel files?
How are comments handled in the vbscript language?
How will you convert a string to upper case string using vbscript?
can anybody tell vb script code for alphanumeric and special character .which is used in qtp the name text field.
What are lbound and ubound in the vbscript language?
What is event handling in vbscript?
how to acces the remote mechine using vb cript(QTP)
Mention what is vbscript procedures?
Which operator is used for fetching the modulus of the 2 numbers in the vbscript language?
Explain sga memory structures?
how to genarate a random numbers in vb?