vbs教程《函数过程》

来源:互联网 发布:阿里云服务器好处 编辑:程序博客网 时间:2024/05/22 14:45
rem function有返回值,sub无返回值rem -------------function: 无参数,无返回值-------------rem 定义rem function hello()rem msgbox("hello")rem end functionrem 调用rem hello()rem -------------function: 1参数,无返回值-------------rem 定义rem function hi(name)rem msgbox("hi " & name)rem end functionrem 调用rem hi("xiaohei")rem -------------function: 多参数,有返回值-------------rem 定义rem function myadd(a, b, c)remdim resultremresult = a + b + cremmyadd = resultrem end functionrem 调用rem msgbox(myadd(10, 20, 30))rem -------------sub: 无参数,无返回值-------------rem 定义rem sub hello()rem msgbox("hello")rem end subrem 调用rem hello()rem -------------sub: 有参数,无返回值-------------rem 定义rem sub hi(name)rem msgbox("hi " & name)rem end subrem 调用rem hi("xiaohei")

0 0
原创粉丝点击