Hi All,
As you all know 80% of coding in QTP is through VB Scripting.So here i will be explaining basic functions in VBScripting.
DataTypes
The Primary Data type of VB Script is Variant.But it has many subtypes.The major sub types are Boolean,Byte,Currency,Date,Integer,Long,String.Functions to convert from one datatype to another is present.We will discuss about those conversion functions in later sections.
Dim
Unlike Java or C it is not necessary to declare a variable before using it in VBS.It will not throw an error if we are using a variable without declaring.To declare a variable the keyword used is Dim.
Syntax:Dim variable_name
Option Explicit
Option Explicit can be used to force declaration of the variable.this should be the first non-comment line of the script.On using the OptionExplicit ,every variable should be declared using the Dim keyword.On Failure of this the system will throw an error."Variable is undefined".
Syntax:Option Explicit
Dim num
Another important aspect which we need to keep in mind is VBS is not a case sensitive language.
So the following statements will display the result Test
Option Explicit
Dim st
ST="Test"
msgbox(ST)
No comments:
Post a Comment