what is option explicit? what is the use of it?
Answer Posted / 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 |
Post New Answer View All Answers
What are main panes available in qtp test browser?
Explain quicktest professional (qtp) testing process?
What is parameter in qtp?
How does qtp identify gui object?
Explain quicktest professional testing process?
Hi ,Can any one pleas explain how to test splash objects using QTP?
what is review
In QA Testing when do you use Loadrunner vs QTP? What are the main differences between those two tools? Explain the purpose with real world scenario examples...In advance thank you!!!
Can we run multiple QTP scripts one after the other without manual intervention? How?
How software tester can use constants and variables in scripts?
How to import a test case present in ".xls" file to TD under a Test set?
Hi How to retrieve data from web element line by line?
Explain sub procedure of vbscript.
What are the features and benefits of quick test pro (qtp 8.0)?
Hi. please provide license key for QTP 9.2, I have windows XP on my machine Thanks in Advance, moreshwar