what is option explicit? what is the use of it?

Answer Posted / ritesh mahendrakar

You can declare variables with the Dim, Public or the
Private statement. Like this:

Dim myname
myname = "ritesh"

However, this method is not a good practice, because you
can misspell the variable name later in your script, and
that can cause strange results when your script is running.

If you misspell for example the "myname" variable
to "mynime", the script will automatically create a new
variable called "mynime". To prevent your script from doing
this, you can use the 'Option Explicit' statement. This
statement forces you to declare all your variables with the
dim, public or private statement.

Put the Option Explicit statement on the top of your
script. Like this:

Option Explicit
Dim myname
myname = "ritesh"

Is This Answer Correct ?    62 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which features or drawbacks of QTP lead to the upgrade for a newer version?

577


Functions call by reference and call by value. i want the diff b/n these 2 and how will be the script for this?in which situation we use these 2..?pls explain me clearly

1259


Who uses qtp tool?

579


How do know the number of browsers opened?

629


If an application name changes frequently i.e while recording it has the name, in this case, how do qtp handles?

585






how to test Web application using QTP software

1571


in qtp 3 sheets is there in data table like global, action1, action2. I want to check the rows and columns in action2. how can check using script?

6333


Can any one tell me about "Mapping Repository Parameter Values" and why we use it....??How to use it???Please, tell the preconditions also...........???? Thanks in Advance

1505


what is test scheduleling?

2019


What environment does qtp run in?

631


wht type of User defined functions or Java Releated functions Do we write in VB scripting

1382


Tell me about your project? please help me how to tell about insurance project

1537


How to use reporter.report event in qtp ?

563


Whats the realtime QTP testing process

1995


Tell me one scenario, the complex functionality you have automated in your project?

1483