' All the loops and statements
' a function can return values
function myfunc(a,b)
sum=a+b
myfunc=sum
end function
'msgbox myfunc(4,8)
' a sub can not return values
sub mysub(x,y)
sum=x+y
'msgbox sum
end sub
'mysub 2,3
' const
const a=4
'msgbox a 'can not change the value
' do while loops
do
x=x+1
'msgbox x
loop while x<5
do while y<5
y=y+1
'msgbox y
loop
while z<5
z=z+1
'msgbox z
wend
' for and exit
for i=1 to 5
'msgbox i
if i=3 then
exit for ' can use exit for do,for,function,sub
end if
next
for i=1 to 5 step 2
'msgbox i
next
arr=array(12,"abcd",date)
for each i in arr
msgbox i
next
dim b(5)
' a function can return values
function myfunc(a,b)
sum=a+b
myfunc=sum
end function
'msgbox myfunc(4,8)
' a sub can not return values
sub mysub(x,y)
sum=x+y
'msgbox sum
end sub
'mysub 2,3
' const
const a=4
'msgbox a 'can not change the value
' do while loops
do
x=x+1
'msgbox x
loop while x<5
do while y<5
y=y+1
'msgbox y
loop
while z<5
z=z+1
'msgbox z
wend
' for and exit
for i=1 to 5
'msgbox i
if i=3 then
exit for ' can use exit for do,for,function,sub
end if
next
for i=1 to 5 step 2
'msgbox i
next
arr=array(12,"abcd",date)
for each i in arr
msgbox i
next
dim b(5)
No comments:
Post a Comment