Answer Posted / jim c
Option Explicit forces the programmer to declare all
variables, rather than letting them be implicitly declared
upon their first use.
This enforces good programming practices and avoids
ambiguity of variable scope.
Here are some simple code examples:
'*************************************
i = 1
Call mySub
WScript.Echo i
Sub mySub
i = 10
End Sub
'*************************************
In this first example, because the programmer is relying on
implicit variable declaration, the subroutine is modifying
global variable i, and the printed result is 10. Now, modify
the code so that the variables are declared:
'*************************************
dim i
i = 1
Call mySub
WScript.Echo i
Sub mySub
dim i
i = 10
End Sub
'*************************************
Now, we actually have two different variables named i, one
with global scope, and one with local scope. The printed
result is now 1.
Since a lot of programmers use i in For..Next loops, you can
see how this could result in unpredictable results without
explicit variable declaration
| Is This Answer Correct ? | 8 Yes | 3 No |
Post New Answer View All Answers
Hello Friends , I am the new joinner of this website. I am working with Sapient ,Gurgoan I would like to ask few qurries regarding the QTP Tool of (Testing) Currently working on QTP Tool . I would like to no learn VB Script can u name some Books which i get in market. And a small issue in QTP I had 2 users right i have to login and send the document from this user to second user right. when i am send this doc some contendId number generates right. now i am loging into second user and i have to search for that contentId right i found it now i dont want to accept the document so i had an opption of check out ok i have to click on check out my QTP Code is like this Browser(" ").Page(" ").WebTable(" ").ChildItem (3,5,"Image",0).click Browser(" ").Page(" ").Link("ChecK Out").Click i new this code is perfectly right but when i am run the script i have to click on that particular contentId and click on check out but now the Problem is started the error is the document has been already checked out remeber every time my content id changes means it is the new contentId which is not been used atleast once Please help me out in this issue i am in big trouble
Mention what is vbscript procedures?
Please let me Know regarding any material regarding VB Scripting which should be easily understandable for Beginners.
What is vbscript procedures?
Hai this is sheik, i want to learn VB scripts for web application pls guide me what are all basic things need to know to learn VB scripts in web application.
What is the use of the date function in the vbscript language?
Which operator is used for fetching the modulus of the 2 numbers in the vbscript language?
Write program for identifyig duplicates in flight Departing from and Arriving in mercury tours(web application).
How will you convert a string to lower case string using vbscript?
Why to use option explicit in vb script?
What is select case statement?
There are 5 web pages.write a script to click the button on 4th web page.
A folder is there inside no of textfiles are avilable. How do count the textfiles. Normally folder means we are using subfolder methods but textfiles is not working for subfolder methods and how do get file name also.
can anyone send me a vb scripts code for clicking on a link and coming back on home page again does the same for many links on a web page.
while using Keyward driven framework in QTPif new requirements are added how to manage it...plz ans