When and why do you use "OPTION EXPLICIT" in VB Script.
Is there any online help or something to learn the script
for Beginners?
Answer Posted / pallavi nandula
When you use the Option Explicit statement, you must
explicitly declare all variables using the Dim, Private,
Public, or ReDim statements. If you attempt to use an
undeclared variable name, an error occurs.
VBScript ingeneral doesn't need variable declaration. For
example without using "Dim" a variable can be directly used
for assigning etc. For ex: temp=1
However, such practise can always be error prone. Ex: if i
want to use the same variable in someother statement and
miss spell it,say
tempe=temp+1
VBScript still considers "tempe" as valid. This case if we
use OPTION EXPLICIT On top of our application and proceed
then application will not proceed unless until u declare
each and every variable. Hence u make sure that ur variable
is serving ur purpose.
in this example u recognize that "tempe" is not desired.
Hope this clarifies.
| Is This Answer Correct ? | 88 Yes | 4 No |
Post New Answer View All Answers
How to use transactions in qtp?
Explain how you can find length of array in qtp?
How the exception handling can be done using quicktest professional (qtp)?
Hi, i run scripts in one machine those r passed.when i run the scripts in client side those r failed.Give me such a scenario when ever u faced?
Which scripting language used by quicktest professional (qtp)?
What if recovery scenarios is also failed for identify the alert ? (We are handling unexpected popup through recovery scenarios but if still recovery scenarios also failed than what should be the approach)
what is the latest version of QTP? Main difference between 9.2 and 10 version
What are the types of object repository?
Where to use function or action?
How may types of defects identify application or your currently working application?pls give me answer..
Can the user toggle between using Local OR and shared OR for the same action?
How can I use Call dlls in QTP ?
.have you ever written compiled module? if yes , tell me about some of the function that you wrote.
What is meant by Step generator?what is the use of this? we have 3 steps know there what r all those.? can u all pls give me clear idea of this
What are the advantages of parameterization ?