VBscript 中的语言基础二

' get familiar with the use of ARRAY
''''''''''''''''''''''''''''''''''''''''
Option Explicit
Dim array(40),i,sum
sum=0
For i=0 To 4
array(i)=i
sum=sum+i
Next
For Each i In array
WScript.Echo i
Wscript.Echo sum
Next
For i=0 To 10 step 2
array(i)=i
sum=sum+i
Next



'''''''''''''''''''''''''''''''
'How to use two for 
Option Explicit
Dim array(10,5)
Dim i,j

For i=1 To 10
  For j=1 To 5
  array(i,j)=i+j
  Wscript.Echo "Answer "&i&" "&j&" "&i+j
  Next
Next
'''''''''''''''''''''''''''''''''''''''
Option Explicit
Dim a,ans
a=100
ans=10
WScript.Echo a Mod ans
a=9
ans=a^3
WScript.Echo ans

你可能感兴趣的:(VBScript,语言,程序人生)