Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / ravi kumar battula

Option explicit we declare at the top of the script so that
we can declare every variable as Dim or other data types.
Some times we do not declare variables, in that situation it
shows error if 'option explicit' is on in the script

Is This Answer Correct ?    24 Yes 3 No

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

Answer / uday kumar_anem

If we use 'Option Explicit', then we must declare the
varible before we use.
If you dont declare the varible, then it returns an error
message.

If you dont use 'Option Explicit' then no need of declaring
the variables.

Is This Answer Correct ?    20 Yes 5 No

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

Answer / rajendra

In VB script

option explicit forces the user to declare every variable
used in the code.

In VB Script is not mandatory to declare the variables.

VB script will be processed by windows scripthost.

Some time script host maynot haddle the undiclared
variables.

so it is a good practice option explicit on the top of the
script code.

once if u declare "option explicit" the each any every
variable must be dicalred before using it in code.

other wise it fires an error nad not allow to run the
script on Windows script host.

It is good coding practice to use "option explicit" on the
top of the code.

byeee

Rajendra Prasad Reddy
rajendra_penumalli@yahoo.com
+919885162742
hyderabad
india

Is This Answer Correct ?    10 Yes 2 No

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

Answer / shanker

If u are using Option Explicit, then variable declaration
in vb script becomes compulsory/mandatory.of course
Declaration is not mandatory in Vb script

Is This Answer Correct ?    7 Yes 2 No

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

Answer / kaps

In VB script it’s not necessary to declare a variable explicitly and we can assign a variable at any step we want. This can cause a problem if the project code is huge (while debugging for any bug in script), as the result may be different than expected.
E.g. we declare a string variable as 'strLogin' to save the login detail but later while assigning by mistake we write 'strLogi' then that Login detail will be saved to 'strLogi' instead of 'strLogin'. This will be a bug in script if we use 'strLogin' afterwards for some other inputs. To prevent such scenario VB script provides 'Option Explicit', which forces user to explicitly declare the variable before using it, otherwise script will throw an error at run time.

Option Explicit
Dim strLogin

Is This Answer Correct ?    3 Yes 0 No

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

Answer / sravani pasam

If we misspell variable in our Script then Script will automatically generates variable for that reason we r using'option explicit'

Is This Answer Correct ?    1 Yes 0 No

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

Answer / raju

Above answer is the opt answer.It is very helpful for me:)..

Is This Answer Correct ?    2 Yes 2 No

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

Answer / reddy

We can use Option Explicit function forcefully to declare variables before going to use that variables in script.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More QTP Interview Questions

In qtp, explain what is crypt object

0 Answers  


How can I generate customized logs in QTP ?

2 Answers   Ordain Solutions,


If there r 1000 test scripts that were written. If a change to any functionality is to be made then how can we know in which script is this functionality existing.

4 Answers   iGate,


hi i am new to qtp i need to run all files by a batch what is the procedure and what are following actions to be take?

1 Answers   ADP,


What is the difference in testing a client-server application and a web application?

0 Answers  


what is Function Definition Generator? can any one explain me in details?

6 Answers   Accenture,


I want to capture data(using keyword) from msdos application using QTP?... Below is little work i could do on it... /* Set app=CreateObject("Wscript.shell") SystemUtil.run ("C:\Users\Agent\Desktop\pumpsim\PUMPSIM.EXE") Window(“PUMPSIM.EXE”).Activate wait(3) app.sendkeys "N" */ Thanks in advance...!!!

0 Answers  


When Object Repository is available what is the necessity of having Descriptive programming which needs more scripting efforts.

3 Answers  


Can I compare two DataBases using QTP ?

1 Answers  


Which recording modes need more memory?

0 Answers  


An object is non standard object, i mapped it to standard object, eventhogh on mapping to standard object i cannot use the methods available on the standard object with the mapped object. How i can use those standard object methods with these mapped object. (((Note : dont tell that we can use virtual object as virtual object is to map nonstandard obj to standard obj)))

0 Answers   HCL,


Can we call qtp test from another test using scripting. Suppose there are 4 tests and I want to call these tests in a main script. Is this possible in qtp?

0 Answers  


Categories