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


Please Help Members By Posting Answers For Below Questions

what is the difference btn risks & Therads in the Test plan documentation?

1597


www.icici.com ,after this.. home page wll came, in this page what r the items we r going to test for manual and what are items we r going to test for QTP... explian clearly with example

1733


Differences between quicktest professional (qtp) and winrunner?

635


Please guide me release notes of Automation once scripts are completed

1472


Which recording modes need more memory?

591






What is 'sleep' in sync point?

633


what type of automation is follwed in the project?

1493


hi all can any body explain how to write the script for finding the mandatory fields which are having [red Astrik sign (*)]

1469


What are the steps involved in recovery scenario wizard?

539


To which environments does quicktest professional (qtp) supports?

603


What is checkpoints for qtp?

543


Why we load add-ins in qtp?

634


How will you report the bug and explain the defect tracking sheet you handled?

2564


Explain the types of object repository?

562


Hybrid framework supports Descriptive programming. Is it true?

662