Thursday, January 3, 2019


Basic Syntax in VBScript

Basic VBScript Syntax
Remember below points about VBScript Syntax.
  1. VBScript is loosely typed language that means you do not need to declare the variables with data type
  2. VBScript comments start with symbol '. You can also comment using rem keyword.
  3. You do not need to put semicolon at the end of the statement like C,C++ and JAVA
VBScript also provides below functions that can be used to find out more information about the variables.

  1. IsArray - This function can be used to check if the given variable is an array or not
  2. IsDate - This function can be used to check if the given variable is a valid date or not
  3. IsEmpty - This function can be used to check if the given variable is empty or not
  4. IsNull - This function can be used to check if the given variable is a null or not
  5. IsNumeric - This function can be used to check if the given variable is valid number or not
  6. IsObject - This function can be used to check if the given variable is valid object or not
  7. TypeName - This function returns the data type of the given variable.
Examples - 


dim a(4)
dim b
b=10

Msgbox  "a is array? -> " & IsArray(a)     'prints true

Msgbox  "b is a date? -> " & IsDate(a)  'prints false

Msgbox  "b is empty? -> " & IsEmpty(b)  'prints false

Msgbox  "b is null? -> " & IsNull(b)   'prints false

Msgbox  "b is numeric? -> " & IsNumeric(b)   'prints true

Msgbox  "b is object? -> " & IsObject(b)   'prints false

Msgbox  "TypeName of b -> " & TypeName(b)   'prints inte




Related Posts:

  • Types of variables in Vbscript Types of variables in Vbscript Variables are storage locations in memory where we can store the the values.In vb script there are 3 types of variables. Scalar  - contains only one value. Array - contains many val… Read More
  • What are the different operators in vbscript? What are the different operators in vbscript? At broad level there are 3 kinds of operators as mentioned below. Arithmetic Operators Comparison Operators Logical Operators Arithmetic Operators in the order of pre… Read More
  • Data Types in vbscript Data Types in vbscript In vb script all variables are initialized with the data type called variant. But we can have below sub-types in vb script. In below table we have mentioned all sub data types in vb sc… Read More
  • Basic Syntax in VBScript Basic Syntax in VBScript Basic VBScript SyntaxRemember below points about VBScript Syntax. VBScript is loosely typed language that means you do not need to declare the variables with data type VBScript comments start … Read More
  • What is vbscript? What is vbscript? VBScript Intoduction Vb script is a scripting language used for performing administrative tasks in system programming.Vb script is a loosely typed language meaning we don't need to define the type of… Read More

0 comments:

Post a Comment

Blog Archive

Translate

Popular Posts

Total Pageviews

150,590

Blog Archive