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:

  • Sub Procedures in VBScript Sub Procedures in VBScript Sub procedures are used to perform the specific task. Sub procedures are used to increase the reusability of the code. Simple example of the procedure Suppose you want to find the sum of … Read More
  • String functions in vbscript String functions in vbscript Below is the list of string functions in vb script lcase ucase len left right mid ltrim rtrim trim replace strreverse string Instr Instrrev strcomp We are going to have a look at each St… Read More
  • What are different conditional statements in vbscript? What are different conditional statements in vbscript? In Vbscript there are 2 types of conditional statements. if ...else Select Case Example of if else -  a = 10 If a > 10 Then Msgbox "a is greater t… Read More
  • Difference between procedures and functions in vb script Difference between procedures and functions in vb script Major difference between procedures and functions in vb script is that procedures can not return the value but functions can return the value.Procedure Example… Read More
  • Loops in Vbscript Loops in Vbscript Here is the list of different looping statements in vbscript. For ....Next For Each ...Next Do While...Loop Do Until....Loop While...Wend 'You can exit from For Loop with Exit For statement'For Loo… Read More

0 comments:

Post a Comment

Blog Archive

Translate

Popular Posts

Total Pageviews

151,898

Blog Archive