Function 的练习:由 S 加到 N 的总和
<script language="VBScript"> <!-- Function Sum1_N(N,S) Dim total,i total = 0 For i = S To N Step 1 total = total + i Next Sum1_N = total End Function Dim Start, Number Start = InputBox("请输入初始值") Number = InputBox("请输入一个整数") MsgBox("由 " & Start & " 加到 " & Number & " 的总和为 " & Sum1_N(Number,Start)) //--> </script>