Sunday, March 10, 2013

A Quick VBScript Tutorial


Option explicit
 Dim x, i

 i = 10

 x="Hello World"
 Wscript.Echo x

 'subroutine cannot return value like function returning void
 mysub()

 ' calling function which returns date
 Wscript.Echo myfunc()


 ' if then elseif else
 if i=10 then
 Msgbox("hello")
 i = i+1
 elseif i = 12 then
 Msgbox ("i is 12")

 else
 Msgbox("came to else")

 end if

' select case
Select case i
 case 11
Msgbox "i is 11"
case 20
Msgbox "i is 20"
case else
Msgbox "default case"
End Select

' for loop
For i= 0 To 5 step 1
Wscript.Echo "hello for loop"
Next

 'Msgbox x

 ' subroutine
 sub mysub()
Wscript.echo "This is mysub()"
 end sub

 ' function which returns date
 function myfunc()
myfunc= Date()
 end function

No comments:

Popular micro services patterns

Here are some popular Microservice design patterns that a programmer should know: Service Registry  pattern provides a  central location  fo...